Ryan,
Nice job. Can you file a ticket against the OGR driver and I'll remove
that filesystem check in trunk asap?
For now I think that is the best approach. Sacrificing error reporting
for missing files (when actually reading from files) is not worth
breaking all the possible connections ogr supports. If you are up for
it, filing a second enhancement ticket for looking into better ways of
accepting arguments for file-based on non-file based connections would
be good. I figure this will apply to both GDAL and OGR plugins.
Dane
On May 7, 2009, at 2:18 PM, Ryan Halterman wrote:
I believe I've got Mapnik reading the DNC data now. Everything
seemed to work except that the file existence check in
ogr_datasource.cpp isn't formulated to accept the OGDI driver's file
string format (gltp://<driver>/<file>). I simply commented out the
check at line 71
if (!boost::filesystem::exists(dataset_name_))...
and rebuilt the plugin. The data loaded (and subesquently seemed to
plot) fine with
lyr.datasource = mapnik.Ogr(file='gltp:/vrf/home/<user>/dnc/
dnc13/a1316120', layer='coa...@ecr(*)_line')
A more robust modification shouldn't be too difficult.
As Jeff mentioned, we've also been discussing importing the data
into a postgis database using ogr2ogr and I have been pursuing that
route as well. I am admittedly very new at this, but that would
seem to offer some advantages. I would appreciate any feedback on
the potential pros and cons of the postgis vs the direct approach.
Thank again,
-- Ryan
On Thu, May 7, 2009 at 1:29 PM, Ryan Halterman <[email protected]>
wrote:
Thanks for the reply Dane,
On Thu, May 7, 2009 at 12:07 PM, Dane Springmeyer
<[email protected]> wrote:
Hey Ryan,
On May 6, 2009, at 5:22 PM, Ryan Halterman wrote:
Hello,
I am trying to read NGA Digital Nautical Charts (VPF/VRF format)
into Mapnik. To do so, I am attempting to create a datasource using
the OGDI driver through the ogr plugin. I have built Mapnik in
Ubuntu 8.10 (and 9.04) with debug on and with ogr support. Upon
importing Mapnik, I receive confirmation of the ogr plugin's
existence. I am able to run ogrinfo on the DNC data source and
receive a list of layers using the following command:
ogrinfo gltp:/vrf/home/<user>/dnc/dnc13/a1316120
Fascinating - i've never heard of this file format.
One of the layers listed is:
11: coa...@ecr(*)_line (Line String)
In order to create the data source in Mapnik, I am attempting the
following:
lyr = mapnik.Layer('test', "+proj=latlong +datum=WGS84")
lyr.datasource = mapnik.Ogr(file='/home/<user>/dnc/dnc13/
a1316120', layer='coa...@ecr(*)_line')
This gives a runtime error indicating line 299 in mapnik/
__init__.py (return CreateDatasource(keywords))
What is the full error?
There is no error message when calling through mapnik.Org(), simply
a blank runtime error. It did show that the error occurred at line
299 of __init__.py. That is what led me to call it through
CreateDatasource().
Maybe try:
lyr.datasource = mapnik.Ogr(file='gltp:/vrf/home/<user>/dnc/dnc13/
a1316120', layer='coa...@ecr(*)_line')
I tried that initially as well, but that returned a "File not found"
error.
Without being at all certain of its correctness, I also attempted to
call CreateDatasource directly with the following:
This will be no different that calling the Ogr function, which just
wraps CreateDatasource.
The only difference is that the python shell (iPython) actually
returns an error message (as seen below) when called with
CreateDatasource().
lyr.datasource = mapnik.CreateDatasource(type='ogr', file=/home/
<user>/dnc/dnc13/a1316120', layer='coa...@ecr(*)_line')
Looks like you are missing a single quote after 'file'
Sorry. That was there when I issued the command. It just didn't
make it into my post.
This returns the following:
ArgumentError: Python argument types in
mapnik._mapnik.CreateDatasource() did not match C++ signature:
CreateDatasource(boost::python::dict)
I am able to use ogr2ogr to convert the DNC to a shapefile and then
import that into Mapnik, but I would greatly prefer to not have to
go through that step. Any suggestions or insight anyone may have
about this or reading Digital Nautical Charts in general would be
appreciated.
Thanks again for your time. Any further comments are appreciated.
-- Ryan
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users