admin管理员组文章数量:1415484
I am creating a web application using OpenLayers. I have implemented functionality such that a user can add a point or polygon to the map that is displayed using JavaScript. I now need to save this data to a shapefile. Any ideas on how?
I am creating a web application using OpenLayers. I have implemented functionality such that a user can add a point or polygon to the map that is displayed using JavaScript. I now need to save this data to a shapefile. Any ideas on how?
Share Improve this question edited Nov 16, 2010 at 18:07 nix asked Nov 16, 2010 at 17:53 nixnix 4,8015 gold badges24 silver badges19 bronze badges3 Answers
Reset to default 2I know it's an old thread but I came here with the same question after doing a bit of googling myself to see if there was anything out there. I concluded that there wasn't but that there could be, so I wrote it:
https://code.google./p/js2shapefile/
It's the first time I've done anything along these lines in Javascript so I'm sure you'll find all kinds of oddities with my code...but, it works, for ESRI Javascript API graphics and Google Maps markers, at any rate. It could be easily extended to take OpenLayers vectors as input too, but I haven't got round to doing that.
You'll probably have to do it on the server, unless there's a javascript implementation of shapelib.
Actually, do you want the web user to get a shapefile to save or do you want to save it on the server?
There's lots of ways of doing it on a server, depending on your server language of choice. In python, you just import the ogr library and write it... You'll need to construct a web request from the client with the data in it though...
Maybe geoscript can help:
http://geoscriptblog.blogspot./2010/06/merging-shapefiles-with-javascript.html
There's a good overview on this issue here. For converting to shape using client side javascipt only, you could base you work on the JavaScript Shapefile to GeoJSON library.
本文标签: javascriptSave Data to Shapefile with OpenLayersStack Overflow
版权声明:本文标题:javascript - Save Data to Shapefile with OpenLayers - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745234004a2648949.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论