Select to view content in your preferred language

problem with WFS Data, GDAL, Python, ArcGIS, & Defining Projection

819
1
08-06-2013 11:40 AM
Town_ofSnowflake
Deactivated User
I'm pulling in data in gml2 format with a EPSG#4267 from a wfs.

I create a datastream in python and then run the following from the python window in ArcMap:

data = datastream.read()

#write the gml data to a gml file
rasterdata = open("E:\\Melo\\USGS" + "\\Roads.gml", 'w')
rasterdata.write(data)
rasterdata.close()

#Run the ogr2ogr to convert to shp
cmd = ["ogr2ogr", "-f", "ESRI Shapefile", "E:\\Roads.shp", "E:\\Roads.gml"]
subprocess.call(cmd)

#Define the projection
infc ="E:\\Roads.shp"
prjfile = "E:\\4267.prj"
arcpy.DefineProjection_management(infc, prjfile)


Unfortunately, when i try to add the layer in ArcMap 10.1 it "appears" blank.  Typically, I've only seen this happen when their was something wrong with the projection.  I know there is data in the file because I've converted it successfully using alternate methods.

I installd GDAL according to these instructions exactly (1500/32 bit/2.7).

I did NOT download and install the ArcGIS bindings .  Do I need them?

Any ideas on what could be causing the layer to appear blank in ArcMap?
Tags (2)
0 Kudos
1 Reply
Luke_Pinner
MVP Regular Contributor

  • You're writing to "E:\\Melo\\USGS\\Roads.gml" but trying to convert "E:\\Roads.gml"

  • You don't need the ArcGIS GDAL python bindings, you are not using them in your script.

  • You can convert directly from the WFS (including defining the projection) using:

ogr2ogr -a_srs EPSG:4267 -f "ESRI Shapefile" E:\\Roads.shp WFS:http://path/to/WFS/service?required_or_optional_parameters_etc...
0 Kudos