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 a GIS newbie, normally a PHP web applications developer.

I am trying to map all boundaries of the MA state representative districts. So I just need to convert polygon coordinates from the MassGIS web service's output into Google-friendly lon/lat coordinates (the WGS84 SRS). In GIS parlance I need to execute a "re-projection."

Below is the link to the XML (6MB, careful). The default SRS is EPSG:26986. You can add the GET parameter &srsName=26986 to the end of it and then toy with that number but I've tried plugging in the WGS84 equivalents in EPSG, which folks are saying are 4326 or 3875, and apparently MassGIS does not have those output formats available.

Here is the response XML: http://giswebservices.massgis.state.ma.us/geoserver/wfs?request=GetFeature&version=1.0.0&typeName=massgis:GISDATA.HOUSE2012_POLY

Then I started playing with the Linux tool gdaltransform which seems promising, but when I plugged in over 100 of the original (EPSG:26986) pairs, it only spits back about four pairs (in the correct EPSG:4326 format). So something is wrong there. If tried dumping the coordinate pairs in a text file of source data, but then the gdaltransform complains that it is not a supported file format.

Obviously the easiest thing would be if someone has some experience with the MassGIS web service and can tell me the right parameter to get these coordinates in the format I need them. But another fine solution would be to help me find a simple, quick conversion script or utility (PHP or Linux) that I could integrate into my web app behind the scenes.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

If you put srsName=epsg:4326 instead of just the number you should get a reprojected set of coordinates. This is not standard but relies on a GeoServer specific parameter.

For a more general solution you can use OGR (specifically ogr2ogr) to import the saved file and reproject it. GDAL is designed for rasters rather than vectors which is why you only get the corners.

ogr2ogr -t_srs EPSG:4326 output.shp input.shp
share|improve this answer
    
Right, I figured out the GET parameter solution 30 minutes after posting! And thanks for that crucial insight into GDAL. –  Adam Friedman Oct 11 '12 at 22:30

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.