Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow late-binding of datasources #622

Closed
artemp opened this issue Oct 11, 2011 · 4 comments
Closed

Allow late-binding of datasources #622

artemp opened this issue Oct 11, 2011 · 4 comments
Milestone

Comments

@artemp
Copy link
Member

artemp commented Oct 11, 2011

Currently when you create a Datasource it immediately (in the constructor) checks to see whether the file/database/table/etc is available.

For cascadenik we now have a compile option which instantiates mapnik objects (including datasources) and then serializes them out to XML. This obviously is a bit annoying if the production DB/data/etc need to be available.

Proposal:

  • Change the constructor signature of datasources to be datasource(const mapnik::parameters& params, bool bind=true). It will still check for the right parameters (eg. table parameter for postgis datasource, file parameter for shape, etc) but NOT attempt to verify that they exist or are accessible.
  • Add a public void bind() method to the datasources which does the same work the constructor used to do - checking files exist, connecting to DBs, sorting out extents, etc. If it's called more than once it no-ops.
  • bind() would be called by the constructor when bind=true (the default), so existing behaviour doesn't change.
  • envelope(), features(), and features_at_point() would all check for bound-ness and call bind() if they're not.
  • the bind() method and the bind constructor parameter would be exposed through the python bindings.
@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[gravitystorm] This would massively help with large-raster data sources. At the moment if a raster is greater than 512*512 ( http://trac.mapnik.org/browser/trunk/plugins/input/raster/raster_datasource.cpp#L135 ) there is significant overhead in pre-processing - leading to >15 minutes mapnik-startup times when using >10,000 raster layers. Deferring this processing to when the raster is actually needed would be great.

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[rcoup] Plan is to port to 0.7.x branch after committed to trunk - the datasource stuff doesn't appear to have changed that much so it shouldn't be too hard.

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] applied to trunk in r2291 and backported to 0.7.2 in r2293

@springmeyer
Copy link
Member

see reworking of this at #962

springmeyer pushed a commit that referenced this issue Dec 17, 2012
Remove bind option for datasources closes #962, reverts #622, refs #1655 and #1656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants