Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using ogr2ogr to create geojson from a shapefile using the -lco WRITE_BBOX=YES argument. Everything is working great except the bound box (bbox) doesn't seem to be the traditional "left, bottom, right, top" EPSG coordinates. Here is an example:

This should be a district in Alabama - [-9847815.3009172, 3522127.8720985, 0,-9650071.0310152, 3741251.3025806]

I'm thinking that it's possibly WKT coords.(?)

I've searched all over for more information about this and was unable to find any information on it. How would I go about converting this to EPSG coordinates? Are there any libraries out there that can do this? Preferably in JavaScript or PHP.

Thanks

share|improve this question
1  
Apart from the odd 0 in the middle, it looks like coordinates to me. What I'm confused about is what you mean by EPSG coordinates. EPSG, in a GIS environment, usually refers to a coordinate system, such as WGS84 (EPSG:4326) or UTM 30N (EPSG:32630) –  MerseyViking May 17 '12 at 15:52
    
looks like Google Mercator to me (apart from the spare 0). But run orginfo on the input file to determine the projection. –  iant May 17 '12 at 16:01
    
Thanks for the quick replies. By EPSG coordinates I just mean standard geographical coordinates. Sorry about my terminology. The projection is indeed Google Mercator. So in the case that the 0 in the middle is just a bug, the first 2 numbers should be a lat, long and the last 2 should be a lat, long? If so when I google map them, they should show the point. However, I'm just getting an error. (We could not understand the location) maps.google.com/… –  Pete May 17 '12 at 16:06
    
Okay, I've added -t_srs EPSG:4326 to convert it from Google Merc and now the coordinates work. However the 0 is still in the middle, I guess it's a bug. Thanks for the help folks. –  Pete May 17 '12 at 16:16
    
Looking at the code, the 0 is the minimum Z extent of the geometry, if it has 3 dimensions; otherwise just X and Y should be exported. So you should either get 4 values for 2D geometry, or 6 for 3D geometry - 5 is definitely wrong! I can see no bug in the code (ogrgeojsonwriter.cpp, 77-100), so maybe it's maximum Z is some value that the JSON driver baulks at, and so just ignores it. –  MerseyViking May 17 '12 at 16:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.