google-code-export / marinemap

Automatically exported from code.google.com/p/marinemap
Other
1 stars 2 forks source link

Generic lingcod shapefile exporter #415

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The northcoast shp exporter is really purpose built to provide useful output 
for the MLPA. And really most of the time we'll probably want to do some custom 
stuff. 

But it would be nice if there was a built-in shp exporter, however generic, 
that could be hooked into any model with a geometry field. It obviously wouldnt 
have the niceties of the nc exporter but would provide a "good enough" 
shapefile right out of the box. 

Original issue reported on code.google.com by perrygeo...@gmail.com on 24 Jun 2010 at 1:35

GoogleCodeExporter commented 9 years ago
There's already a pretty solid mechanism for exporting shapefiles via the 
lingcod.shapes app:

 18 def shapefile(request):
 19     from lingcod.shapes.views import ShpResponder
 20     regionqs = models.StudyRegion.objects.all()
 21     shp = ShpResponder(regionqs)
 22     return shp()

This view could easily be added to any app as needed. 

Original comment by perrygeo...@gmail.com on 16 Aug 2010 at 8:01

GoogleCodeExporter commented 9 years ago
Does this handle attributes?

Original comment by underbluewaters on 23 Aug 2010 at 5:16

GoogleCodeExporter commented 9 years ago
Yes.. but not as gracefully as the northcoast version (field names are 
truncated, "choices" are not reflected, instead of following foreign key 
relationships the fk integer is used, etc.). It is the best that can be done 
for a generic solution. 

To do it better like the northcoast mpa export requires hardcoding assumptions 
about the model and having an intermediary "shp" model to flatten the original 
model into a shp friendly table. 

Original comment by perrygeo...@gmail.com on 23 Aug 2010 at 5:28