I need to convert a user's UTM input (WGS 1984) into Decimal Degrees, preferably using ESRI's ArcGis. I've already got the code to retrieve the zone (formatted like 14N, 22S, etc.) and the easting and northing factors. What do I do from here?
Edit: we expect the input as a string like: 14N 423113mE 4192417mN. I can easily extract the numbers (and a character) 14, N, 423113, and 4192417 from the string above. I just need to somehow translate that to Decimal Degrees.
There is no specific information about input data.
Here is some general info to start from:
The easiest way is to use Geoprocessing engine to reproject the whole feature class. Use C# class for Project tool from Data Management toolbox.
Another way is to use Project method of IGeometry is you want project only several features.
EDIT: for your input data use solution 2.
One more easier way is to use .NET port of open-source library Proj.4 - Proj4Net. For such simple task it is much more easier to use than ArcObjects classes.
Related
I'm currently working withing C# to put images in my api database (school project) and I want to store ISO, Aperture and Shutterspeed as well. Now those are stored in the metadata as APEX or EXIF and not the 'normal' values. I've already did some research and found a way to calculate the Aperture: var value = Math.Round(Math.Pow(2,apexValue/2),1); but it makes rounding fault for some (5.7 instead of 5.6, 22.6 instead of 22, ...) and so I was wondering if there is an easy way to convert those to the values know by people (aperture to f-stops, shutterspeed to seconds, iso to iso values)?
At this point, I'm looking into Property Item Descriptions but I'm a bit confused by them because if we take Aperture for example: the property is called: PropertyTagExifAperture and so you would think that it is an Efix value but the description states: Lens aperture. The unit is the APEX value. So what is it then, Efix or APEX?
Thanks for your time!
I'm working on an integration process that requires the currency conversion between a list of values in specific currency to a concrete given currency.
For this process will exists 2 files, one containing the exchange rates and other containing the prices with the origin currency.
The exchange rates files looks like this:
Text:USDtoEUR;Origin:USD;Destination:EUR;Value:0.7
Text:EURtoCAD;Origin:EUR;Destination:CAD;Value:0.5
The file containing the prices with the origin currency (and also the target currency) looks like this:
Index:0;TargetCurrency:CAD
Index:1;Description:Product1;Value:150;Currency:EUR
Index:2;Description:Product2;Value:3;Currency:USD
For this specific case there is no direct way to convert from USD to CAD, so I need to first convert it to another currency present in the file that has CAD exchange rate (EUR) and then convert it to CAD.
This is a very basic scenario, but I'm guessing those files can contain more complex ones, where maybe it's required to convert 2 or 3 times before reaching the target currency.
What I'm planning to do is to insert the content of the exchange rates file into a SQL Server table and then start a very manual process of looking records containing the target currency... but I've never faced this scenario and don't know if this could be an acceptable approach in terms of speed/performance, that's why I'm wondering if there is a standard algorithm or data structure best suited for this process.
I will appreciate your help
If you need to take the currency conversion rate into consideration to find an optimal conversion path, you would use Bellman-Ford Algorithm .
This link may help you.
But, if the performance of the conversion is matters, you need to use an algorithm to find the shortest path between two nodes (visiting fewer nodes, regardless of the conversion cost) like BFS or DFS
(means traversing the tree to find the shortest path between two nodes(two currencies).
I encountered a scenario where i have to send an array of integers as parameter from specflow feature file. I could have used tables which i don't want to do as i have send as row[] or col[]. If i pass parameter as a string
eg: Given set the value as '470,471,472,472'
and receive it and do split in step definition file. How different is StepArgumentTransformation from the above scenario? Is any other benefit in using step argument transformation. I understand we can convert XML,Date or any object. Why do we have to use stepargumenttransformation???
I hope I understood the question correctly.
Specflow supports some automatic transformation out of the box, so things like converting to Date, Double, int etc etc, and it does these by default as there is no ambiguity about them. You can easily convert a string to a double or a Date as you know the locale being used.
Why isn't converting to arrays supported? I suppose it could be, but there is some ambiguity. What should the list separator be? a comma? What about locales that use that as a separator between the whole and fractional part of a number?
So providing a default implementation of something which converted a list to int[] or IEnumerable<int> could be possible, but its just likely to get some people asking why it doesn't work for them when they have used ☃ as a list separator.
It's better to leave the things with ambiguity to individuals to implement, rather than guess at the best implementation.
The StepArgumentTransformation you want is very simple to write and could be included in an external step assembly if you wanted to share it amongst many projects.
So to answer your many questions:
It's not really any different, it just encapsulates it in a single place, which is good practise, which is a benefit.
Yes you can convert any object.
You don't have to use StepArgumentTransformation, many people don't, but IMHO they make your life much easier
I have a list of coordinates that I want to plot on Google Maps, but I can't figure out how to do that. The coordinates, depending on how I plot them, appear to be all around the globe, while they should be placed in Trondheim, Norway. (And the application I have extracted them from successfully places them in Trondheim, so I know they are correct.)
A normal Google Maps coordinate from Trondheim looks like this:
63.4304, 10.395069
My coordinates, however, look like this:
long, lat
1154262, 9182277
1143762, 9184473
1157168, 9194133
1157375, 9200167
1164505, 9209786
I believe that these are in some kind of WGS84 format, but as I am a complete novice on this field, I am not completely sure. I think so because of the headers in the XML I have extracted them from:
<rss version="2.0"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:georss="http://www.georss.org/georss"
xmlns:gml="http://www.opengis.net/gml"
xmlns:mappoint="http://virtualearth.msn.com/apis/annotate#">
When I try to use this coordinate converter, it returns coordinates in Kazakhstan. I am utterly confused. All other converters I have tried either returns locations in strange countries or in the middle of the oceans, or they fail to convert my data at all.
Does anybody here know what kind of coordinates I have, and how I can convert them to normal latitude and longitude degrees?
A formula is enough, but if there exists any libraries for this, I am using C# as development language. Any other languages would suffice, however, as I am probably able to convert them to my own anyway.
WGS-84 is Spherical Mercator, the projection system used by Google, so the coordinates you have provided are obviously not. Unfortunately for any formula to work you will need to find out the projection that your points are in.
Some more detailed information on projection is available here: http://courses.washington.edu/gis250/lessons/projection/
And a library to convert between common coordinate systems in .net is available at: http://www.doogal.co.uk/dotnetcoords.php.
Would it be possible for you to open the map layer in an GIS program such as: http://www.qgis.org/en/site/ and use the options available to determine the projection of the layer?
Some tips for identifying the coordinate system (written for ARCGIS but the programs are similar): http://resources.arcgis.com/en/help/main/10.1/index.html#//003r00000004000000 https://gis.stackexchange.com/questions/7839/best-practices-for-identifying-the-unknown-coordinate-system-of-a-shapefile
Does anyone know of a C# library that can parse geo coordinates from one string without having to specify the format upfront. The goal is to enable "google like" data entry and interpretation.
Some formats that should be supported:
"12 34.56'N 123 45.55'E"
"12°N 34°W"
"12.345°N 123.456°E"
...
I've been working on a simple geospatial library which can parse coordinate strings. It is called Geo, and is licensed under the LGPL.
The Coordinate class has a static Parse method, and a couple of static TryParse methods.