Converting GPS Coordinates to map

5933
6
05-17-2013 08:40 AM
Labels (1)
DmitriyShantzer
New Contributor
Hello,
I will try to explain my problem. I have images of electric towers, made by camera. So i have EXIF data in this images including such data as GPS Latitude (min sec gr) and GPS Longitude. My application must associate images with fetures on map or just with map points. So i have to convert GPS coordinates of images to map coordinates. How can i do this?
0 Kudos
6 Replies
AnttiKajanus1
Occasional Contributor III
Check samples from ArcGIS Runtime SDK for WPF under Geometry -> Geometry operations -> Project and Project Online

If that doesn't help, let us know.
0 Kudos
DmitriyShantzer
New Contributor
Check samples from ArcGIS Runtime SDK for WPF under Geometry -> Geometry operations -> Project and Project Online

If that doesn't help, let us know.


Thanks alot for your answer.
1. Geometry -> Geometry operations -> Project
To make the projection they use LocalGeometryService. So, as i understand, i need UrlGeometryService.
2. Geometry -> Geometry operations -> Project Online
To make the projection they use GeometryService. So, again i need url for GeometryService.

But i have only reference to MapServer, such as
http://192.168.204.199/ArcGIS/rest/services/rumap/MapServer, and no more 😞
I know Origin and SpatialReference but have no idea how to work with them.
Origin:
X: -22046831,8407
Y: 33218003,68689
Spatial Reference: PROJCS["WGS_1984_World_Mercator_100",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",100.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]

P.S. My first idea was using web merator such as

WebMercator mercator = new WebMercator();
var mp = mercator.FromGeographic(new MapPoint(mapPoint.X, mapPoint.Y));


And that code works fine on esri World_Street_Map (http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer). But on my map i get wrong coordinates values. I think that i have to use map SpatialReference, but i don't know how.
I will be very glad for any help.
Thanks.
0 Kudos
AnttiKajanus1
Occasional Contributor III
What is your maps SpatialReference? If you don't set it explicitly it get SpatialReference from first layer (usually basemap).

If you can use LocalGeomteryService in your application you can use the code from Project example:



   LocalGeometryService.GetServiceAsync(lgs =>            {                _geometryTask = new GeometryService();                _geometryTask.Url = lgs.UrlGeometryService;                _geometryTask.ProjectCompleted += geometryService_ProjectCompleted;                _geometryTask.Failed += geometryService_Failed;             });
After this is completed, you should have access to the GeometryService through task (_geometryTask). You should get the UrlGeometryService from lgs parameter.See also http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#//017000000039000000
0 Kudos
DmitriyShantzer
New Contributor
What is your maps SpatialReference? If you don't set it explicitly it get SpatialReference from first layer (usually basemap).

If you can use LocalGeomteryService in your application you can use the code from Project example:



   LocalGeometryService.GetServiceAsync(lgs =>            {                _geometryTask = new GeometryService();                _geometryTask.Url = lgs.UrlGeometryService;                _geometryTask.ProjectCompleted += geometryService_ProjectCompleted;                _geometryTask.Failed += geometryService_Failed;             });
After this is completed, you should have access to the GeometryService through task (_geometryTask). You should get the UrlGeometryService from lgs parameter.See also http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#//017000000039000000


My partners gave me only reference to MapServer. And I have no access to other services and i do not know if they exists. So i have only map. I don't have any ARCGiS Server solutions on my PC, so, as i understand, i don't have LocalGeometryService.

Am i understand you corrcetly, that the only way to convert my wgs84 coordinates to map coordinates is to access GeometryService and make the projection?
Can i make this conversion without GeomtryService having only MapServer?
0 Kudos
AnttiKajanus1
Occasional Contributor III
If you are using Standard level ArcGIS Runtime licence in your application you can use Local Server provided by the ArcGIS Runtime SDK for WPF (no other arcgis stuff installation needed) but if you are using Basic level you can't use Local Server. About this you can check http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#/Functionality_set_requirements/....

If you want to use GeomteryService that is hosted in ArcGIS Online you can start with : http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer
Tasks.arcgis.online is partly retiring in the end of this year, but I have asked what is the prefered service provided by the ArcGIS Online and will come back with that info.

This is the solution that I have used in all my cases but you could create your own projection, use other libraries to do that and I might be unaware of easier solutions provided by the ArcGIS Runtime SDK for WPF.

Edit:

If you are projecting from WGS84 coordinates (WKID=4326) to web mercator (WKID=102100) then you can use WebMercator helper class. Just make sure that paramater MapPoints spatial reference is set to correct when giving it to the WebMercator projection method.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

If your application is licensed as Basic then you can use online geometry services.

If your application is licensed as Standard you can use the LocalGeometryService included with the ArcGIS Runtime SDK for WPF (no ArcGIS Server required).

In the future we would like to provide additional local geometry capabilities - but in the meantime, there is another option which you may want to consider - the CoordinateConversion class (ESRI.ArcGIS.Client.Geometry). This provides a number of methods to convert from MapPoint geometries to common coordinate notations (e.g. decimal degrees) and back again. Therefore you can convert a MapPoint in one coordinate system to decimal degrees and from decimal degrees back to a MapPoint in another coordinate system:
http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Cli...

Cheers

Mike
0 Kudos