Re: [Talk-GB] OpenHants - doing something with the Hants CC data in the meantime
Hello Rob, Sorry for the late reply on this. Basically how it works is: - the shapefile was converted to Postgres SQL using shp2pgsql; - the data was imported into a PostGIS database; - some custom code (actually same underlying code as Freemap) was written to fetch data as GeoJSON from the database by bounding box; - Leaflet was used to produce the overlay; this is quite easy as Leaflet automatically handles GeoJSON. I'll try and write it up as a blog post. Some (old) code for doing this is on the Freemap github site; I'll try and update it in the next few days. Nick -Rob Nickerson wrote: - To: talk-gb@openstreetmap.org, nick.whitel...@solent.ac.uk From: Rob Nickerson Date: 09/06/2012 12:02AM Subject: Re: [Talk-GB] OpenHants - doing something with the Hants CC data in the meantime Fantastic use of the data Nick! Is there any guides for how to do something similar? I was trying to visualise the Natural England data using Leaflet but failed miserably as the shapefile is too big. Your website appears to load just the bit needed. Would I be able to use some of your code? Cheers, RobJN p.s I'm not hugely tech savy, but with a simple set of steps (e.g. Load data in x, tweak code where there are references to y&z, etc) should be enough to get me started as I can research the details on google. ___ Talk-GB mailing list Talk-GB@openstreetmap.org http://lists.openstreetmap.org/listinfo/talk-gb
Re: [Talk-GB] OpenHants - doing something with the Hants CC data in the meantime
On 09/06/12 00:02, Rob Nickerson wrote: Fantastic use of the data Nick! Is there any guides for how to do something similar? I was trying to visualise the Natural England data using Leaflet but failed miserably as the shapefile is too big. Your website appears to load just the bit needed. Would I be able to use some of your code? One way to only display the data for the area you are displaying is to use AJAX. Leaflet will give you the bounds of the currently displayed area, you can get this whenever the map is scrolled or zoomed (with an event) and fire off an ajax request for the data for that area. Your ajax request needs to be responded to by something, such as PHP, CGI, ASP or whatever, that can look up the data for that area, wrap it up in a useful form and send it to the browser to redraw that area. I use JSON since the JavaScript in your browser handles this well. For vectors it is useful to use GeoJSON - Leaflet handles this very well. On the server side I would load the shapefiles into a database - it depends what you use on your server - I use MySQL since my cheap and cheerful host provides PHP & MySQL. This all works with both Leaflet and OpenLayers - I generally prefer Leaflet. I wrote blog post [1] [2] about using markers and there is a similar piece on Switch 2 OSM [3]. maybe Nick would like to write up his vector display too. [1] http://chris-osm.blogspot.co.uk/2011/05/leaflet.html [2] http://chris-osm.blogspot.co.uk/2012/03/more-gb-postcode-goodness.html [3] http://switch2osm.org/using-tiles/getting-started-with-leaflet/ -- Cheers, Chris user: chillly ___ Talk-GB mailing list Talk-GB@openstreetmap.org http://lists.openstreetmap.org/listinfo/talk-gb
Re: [Talk-GB] OpenHants - doing something with the Hants CC data in the meantime
Fantastic use of the data Nick! Is there any guides for how to do something similar? I was trying to visualise the Natural England data using Leaflet but failed miserably as the shapefile is too big. Your website appears to load just the bit needed. Would I be able to use some of your code? Cheers, RobJN p.s I'm not hugely tech savy, but with a simple set of steps (e.g. Load data in x, tweak code where there are references to y&z, etc) should be enough to get me started as I can research the details on google. ___ Talk-GB mailing list Talk-GB@openstreetmap.org http://lists.openstreetmap.org/listinfo/talk-gb
[Talk-GB] OpenHants - doing something with the Hants CC data in the meantime
Hi, While waiting for the decision as to whether we should use the Hants CC data, I've started work on a small side-project "OpenHants" which overlays the Hants CC footpath data as a separate layer on top of a kothic-js rendered OSM map (basically same server side code as for Freemap). Footpaths are green, bridleways are brown and byways red (no key yet) and you can report problems (just saves it in a database at the moment, aim is to create an RSS feed). What I'd like to do is allow people to report problems in the field via an Android app (I have something similar written already). It also shows which Hampshire ROWs are not in OSM yet. It's at www.free-map.org.uk/hampshire/ - requires an up-to-date browser (e.g. IE must be 9) Nick ___ Talk-GB mailing list Talk-GB@openstreetmap.org http://lists.openstreetmap.org/listinfo/talk-gb