Saturday, 15 January 2011

android - osmdroid coordinate conversion for markers -


I am facing a problem with the coordinate system with the Osmodode and recently released Gilders 2 Map API.

This API wants to add me back to the map, which is POIs (which just perform well, yes :))

is an example:

  {"Poi_id": 1486, "name": "falulu", "type": "milestone", "floor": 1, "coordinate": [19760.9,15379.5]}   

Therefore, I have directed the full XY in relation to the XY size of the entire map.

But how to convert it to a GeoPoint that I can use for a marker location?

When I use TileSystem.PixelXYToLatLong (...) I always get the same results: -84928320, 178593750,0 Which world has the lower right .

I do not think what I'm doing wrong. Any ideas?

Goddchen

It all depends on how the X, Y coordinates Some suggestions for interpreting are:

  1. Try to use the projection class of the map to convert from pixels to a geopoint.

      IGeoPoint p = mMapView.getProjection (). FromPixels (...);    
  2. Is there a possibility of being in zoom level? If you do not specify a zoom level in the API, you will need to adjust it accordingly.

  3. Finally, note that OSMDOdD has used the center of the map as the original and not the top-left of the map. You may need to offset your coordinates by half the size of the world to offset them:

      finalize the worldsize_2 = tile system. Mapasis (Zoomleval) / 2; Last adjusted x = x - worldsize_2; Last adjusted Y = y - worldsize_2;      

No comments:

Post a Comment