If I convert to a shapefile, it all seems to work:

> ogr2ogr -f "ESRI Shapefile" plots.shp plots.ovf

>>> import mapnik
>>> ds = mapnik.Ogr(file='plots.shp', layer='plots')
>>> len(ds.all_features())
5319
>>> ds.all_features()[0].envelope()
Envelope(-122.18573661,37.4776842499,-122.185493497,37.4779477793)


On Wed, Feb 16, 2011 at 1:11 PM, Dane Springmeyer <[email protected]> wrote:

> David,
>
> I'm not sure what is wrong. The ALLCAPS "ERROR 1:..." is an indication that
> the original error is being thrown from the OGR library, likely specifically
> the VRT Layer provider in OGR, and Mapnik is simply catching this error and
> re-throwing.
>
> Could you try converting that VRT to another file type using ogr2ogr, and
> see if you get the error still?
>
> Dane
>
> On Feb 16, 2011, at 12:50 PM, David Wiesen wrote:
>
> > I am trying to use an Ogr data source to hook up MySQL as a backend
> > for mapnik.  However, I am running into early problems:
> >
> > >>> import mapnik
> > >>> ds = mapnik.Ogr(file='plots.ovf', layer='plots')
> > ERROR 1: GeometryType wkbMultiPolygon not recognised.
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> >   File "/usr/lib/pymodules/python2.6/mapnik/__init__.py", line 429, in
> Ogr
> >     return CreateDatasource(keywords)
> > RuntimeError: GeometryType wkbMultiPolygon not recognised.
> > >>>
> >
> > Here is my plots.ovf file:
> >
> > <OGRVRTDataSource>
> >     <OGRVRTLayer name="plots">
> >         <SrcDataSource>MYSQL:mydb,tables=plots</SrcDataSource>
> >         <SrcSQL>SELECT geometry_text FROM plots</SrcSQL>
> >         <GeometryType>wkbMultiPolygon</GeometryType>
> >         <GeometryField encoding="WKT" field="geometry_text"/>
> >     </OGRVRTLayer>
> > </OGRVRTDataSource>
> >
> > And running ogrinfo on that file seems to work fine:
> >
> > > ogrinfo -al plots.ovf
> > INFO: Open of `plots.ovf'
> >       using driver `VRT' successful.
> >
> > Layer name: plots
> > Geometry: Multi Polygon
> > Feature Count: 5319
> > Layer SRS WKT:
> > (unknown)
> > geometry_text: String (0.0)
> > OGRFeature(plots):0
> >   geometry_text (String) = MULTIPOLYGON(((-122.185673052387
> 37.4777167873215,-122.185646862691 37.4777143222677,-122.185625100915
> 37.4777096171752,-122.185604979133 37.477702249983,-122.185586517242
> 37.4776939875647,-122.185571439503 37.4776896768873,-122.185551919026
> 37.4776862811476,-122.185526847508 37.4776842498882,-122.185493496544
> 37.4776884616152,-122.185519496983 37.4779477792701,-122.185736610317
> 37.4779335691591,-122.185698114051 37.4777179351354,-122.185673052387
> 37.4777167873215)))
> >   MULTIPOLYGON (((-122.185673052387003
> 37.477716787321498,-122.185646862691002
> 37.477714322267701,-122.185625100915004
> 37.477709617175201,-122.185604979133004
> 37.477702249982997,-122.185586517242001
> 37.477693987564699,-122.185571439502993
> 37.477689676887302,-122.185551919025997
> 37.477686281147598,-122.185526847508001
> 37.477684249888199,-122.185493496543998
> 37.477688461615202,-122.185519496983005
> 37.477947779270103,-122.185736610316994
> 37.477933569159099,-122.185698114050993
> 37.477717935135402,-122.185673052387003 37.477716787321498)))
> >
> > OGRFeature(plots):1
> >   geometry_text (String) = MULTIPOLYGON(((-122.185312727769
> 37.4777007844723,-122.185339358864 37.4779597716911,-122.185518381277
> 37.4779477879059,-122.185492383406 37.4776884695019,-122.185312727769
> 37.4777007844723)))
> >   MULTIPOLYGON (((-122.185312727769002
> 37.477700784472297,-122.185339358863999
> 37.477959771691097,-122.185518381277006 37.477947787905897,-122.185492383406
> 37.477688469501899,-122.185312727769002 37.477700784472297)))
> >
> > OGRFeature(plots):2
> >   geometry_text (String) = MULTIPOLYGON(((-122.18512996304
> 37.4777132757613,-122.185157777835 37.477971168142,-122.18533719723
> 37.4779604484075,-122.185310413917 37.4777020564695,-122.18512996304
> 37.4777132757613)))
> >   MULTIPOLYGON (((-122.185129963039998
> 37.477713275761303,-122.185157777835002
> 37.477971168141998,-122.185337197229998
> 37.477960448407501,-122.185310413916994
> 37.477702056469496,-122.185129963039998 37.477713275761303)))
> > ...
> > _______________________________________________
> > Mapnik-users mailing list
> > [email protected]
> > https://lists.berlios.de/mailman/listinfo/mapnik-users
>
>
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to