<p dir="ltr">av,</p>
<p dir="ltr">Can you check if ogr2ogr can convert the shapefile to mapinfo?</p>
<p dir="ltr">--<br>
Best regards,<br>
Chaitanya Kumar CH</p>
<div class="gmail_quote">On Dec 26, 2013 8:14 AM, "Avenger Maslog" <<a href="mailto:amamaslog@gmail.com">amamaslog@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><span><span>Hi Everyone!<br><br></span></span></div><span><span>I'm having an issue with creating MapInfo .tab files. I'm trying to automate the process of creating either .tab or .shp files using the same set of codes. It works fine when the output specified are shapefiles but fails with a message: "Failed writing geometry for feature id #" for each .tab point feature that I was trying to create.The input is dictionary information and the output comes out as either .shp or .tab depending on which one was specified. I really hope somebody could point out the reason why it works with shapefiles but not with tab files. Thanks in advance!<br>


<br>        if fileType == "TAB":<br>            driver = ogr.GetDriverByName('MapInfo File')<br><br>        if fileType == "SHP":<br>            driver = ogr.GetDriverByName('ESRI Shapefile')        <br>


            <br>        featureDataSource = driver.CreateDataSource(fileName)<br>        <br>        layerName = "FeatureList"<br>        featureSpatialRef = osr.SpatialReference()<br>        featureSpatialRef.ImportFromEPSG(4326)<br>


        featureLayer = featureDataSource.CreateLayer(layerName, srs = featureSpatialRef, geom_type=ogr.wkbPoint)<br>        <br>        standardFieldsList = []<br>        <br>        standardField = ""<br>            <br>


        for attrib in attribList:            <br>            <br>            if attrib["FLD_KEY"] == "ATTRIB_NAME":<br>                standardField = attrib["FLD_VAL"]<br><br>            if attrib["FLD_KEY"] == "DATA_TYPE":<br>


                standardField = standardField + "." + attrib["FLD_VAL"]<br>                <br>            if attrib["FLD_KEY"] == "DATA_LEN":<br>                standardField = standardField + "." + str(attrib["FLD_VAL"])<br>


        <br>            if attrib["FLD_KEY"] == "DEF_VAL":<br>                standardFieldsList.append(standardField)<br>                standardField = ""        <br>        <br>        standardFieldsFileCreator = FileCreator()<br>


        standardFieldsFileCreator.createStandardFields(standardFieldsList, featureLayer)<br><br>        featureObj = ogr.Feature(featureLayer.GetLayerDefn())<br>        featurePoint = ogr.Geometry(ogr.wkbPoint)<br>        <br>


        for feature in featureList:<br>            for fieldName in feature.keys():<br>                fieldValue = feature[fieldName]<br>                featureObj.SetField(str(fieldName), str(fieldValue))<br>            <br>


            coords = str(feature["COORDS"])<br>            coords = coords.strip()[1:-1]<br>            coords = coords.split(", ")<br>            <br>            featurePoint.AddPoint(float(coords[0]),float(coords[1]))        <br>


            featureObj.SetGeometry(featurePoint)<br>            <br>            featureLayer.CreateFeature(featureObj)<br><br>        featureDataSource.Destroy()<br><br></span></span></div><span><span>av<br></span></span></div>


<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div>