<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>Hello,</div>
<div> </div>
<div>I'm not able to save a spatial reference to a GML file and would like help understanding why.  I’m creating a new GML from a copied feature.  I assign the spatial reference to both the output layer and geometry.  During debug, the layer and geometry report 
that the SR has been assigned correctly (GetSratialRef/GetSpatialReference).  When I open the result GML file in another script, the spatial reference is empty.</div>
<div> </div>
<div>It’s a non-standard SRS (albers, units feet) – not sure if this is an issue.</div>
<div> </div>
<div>I'm using GDAL 1.10 compiled with Expat.  I’m fairly new to all of this.  Any help is appreciated.  I’m including most of the script, b/c I’m not sure where my error might be.  Some of it is taken from the  GDAL/OGR Cookbook.</div>
<div> </div>
<div>    drv = ogr.GetDriverByName("GML")</div>
<div>    ds = drv.Open(gmlin,0)</div>
<div> </div>
<div>    srs = osr.SpatialReference()</div>
<div>    proj4str = "+proj=aea +lat_1=29.5n +lat_2=45.5n +lat_0=23.0n +lon_0=96.0w +x_0=0.0 +y_0=0.0 +units=us-ft +datum=NAD83"</div>
<div>    srs.ImportFromProj4(proj4str)</div>
<div> </div>
<div>    lyr = ds.GetLayer()</div>
<div>    lyr.SetAttributeFilter("cat = " + cat)</div>
<div>    outds = drv.CreateDataSource(gmlout,options = ["FORMAT=GML3"])</div>
<div>    outlyr = outds.CreateLayer(outlyrname,srs,lyr.GetGeomType()) </div>
<div>    inLayerDefn = lyr.GetLayerDefn()</div>
<div>    for i in range(0, inLayerDefn.GetFieldCount()):</div>
<div>        fieldDefn = inLayerDefn.GetFieldDefn(i)</div>
<div>        outlyr.CreateField(fieldDefn)</div>
<div>    outLayerDefn = outlyr.GetLayerDefn()</div>
<div> </div>
<div>    for feat in lyr:</div>
<div>        geom = feat.GetGeometryRef()</div>
<div>        outfeat = ogr.Feature(outLayerDefn)</div>
<div>        for i in range(0, outLayerDefn.GetFieldCount()):</div>
<div>            outfeat.SetField(outLayerDefn.GetFieldDefn(i).GetNameRef(), feat.GetField(i))</div>
<div>        geom.AssignSpatialReference(srs)</div>
<div>        outfeat.SetGeometry(geom)</div>
<div>        outlyr.CreateFeature(outfeat)</div>
<div> </div>
<div>Thank you,</div>
<div>Elke</div>
<div> </div>
<div> </div>
</span></font>
</body>
</html>