0

I have a dxf file of a town in meter coordinates. I need to extract polylines from the map and convert them to geographical coordinates. My idea is to add 3 or 4 points on the map with known coordinates. I will place them using google map as reference. These 3 or 4 points will be placed at intersections roads so I can not place them as they defined a rectangle (I think it would be simpler). I can not found out what calculation I have to do to convert all the coordinates of the objects of the map.

google map earth radius: 6378137 meter. so, If I consider 3 points, I will have 3 relations: (x1,y1) with (lat1, lng1) (x2,y2) with (lat2, lng2) (x3,y3) with (lat3, lng3)

I have done one simple conversion with only 2 points but I'd like a more accurate result. I preferably use c/c++ to do it.

example of one equivalent point: latitude: -2.148707 longitude: -79.876270 x: 2012078.15 y: 498355.88

It's not a UTM, I verify it from here. Because I do not know if it s a normalized.

I googled a lot, I found libraries, but without knowing if tmy coordinates meet a specific format, I don't think I can use one.

Anyway, thanks to read and I hope someone could help me.

yoh
  • 154
  • 1
  • 10

2 Answers2

0

It is not as easy at that. First you need to know which reference ellipsoid you are using (e.g. WGS-84) and then which projection. I wouldn't try to implement this by hand, but use postgis instead, which would do all this ugly work for you.

Hyperboreus
  • 31,997
  • 9
  • 47
  • 87
0

The correct way is to ask the provider of the file what the coordinate system is related to. dxf is not realy a suitable format. you need a format like ESRI Shp file or mif/mid with a defined geographic coordinate system. otherwise it is a bit unclear if the data are precise enough, to be used for geographic reference. However it is not difficult to transform between meters and wgs84 lat longitude, especially if the area is not more than 10-20 miles. you could use as first try the cylyndrical equidistant transformation, which is only a few lines of simple code. look also if the y-achsis in the dxf file points to the nort pole, otherwise you must find out that amount of false northing and rotate back to north. MapInfo Professional is a tool with free evaluation period, this tool alows to specify reference points for such unknown coordinate systems. (at least for bitmaps i rememer that feature).
But if you are a professional sw developper, You should reject that file and demand a version in wgs84 lat lon.

AlexWien
  • 28,470
  • 6
  • 53
  • 83