Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Re: Re: GPS Coordinates to Map

"Jesse Eichar" <jeichar@xxxxxxxxxxxxxxx> wrote in 
message news:20BF789C-0A55-49FC-9B84-ACB7E0320A73@xxxxxxxxxxxxxxx...
> Hi,
>
> So what exactly are you trying to do here?  Just transform from a  point 
> in world space to a coordinate on the screen?  If that is the  case then 
> you can use one of the context's worldToPoint() methods to  make the 
> transformation.  Look at the AbstractContext interface for  the code if 
> you don't want to use the context methods directly (you  can create a 
> ToolContext with the method:   ApplicationGIS.createContext(map).  Also 
> all MapGraphics have access  to a MapGraphics context.  A final place to 
> look is the layer's  layerToMapTransform().
>
[snip]

I've got code that is correctly giving me the coordinates:

        double lat = getLatValue(location);
        double lon = getLonValue(location);
        Coordinate coordinate = new Coordinate(lat, lon);

But, when I do this...

MapGraphicContext context... (geeting it from the MapGraphic)
Point point = context.worldToPixel(coordinate);

I get a very large point - way off the screen.  When I render it...

            point = buildPoint(context, location);
            int x = (int) point.getX();
            int y = (int) point.getY();
            graphics.fillRect(x - 3, y - 3, 5, 5);

It's nowhere to be found...

Help??? 





Back to the top