A few small updates to Freemap 0.6, the new experimental version of Freemap using kothic-js rendering, since I last posted. Bridges and railways now appear, but the main feature is coastline. How was this done?
It was quite simple but thought I’d post it here anyway. Firstly, the standard processed_p.shp file used for Mapnik rendering was converted to SQL using the shp2pgsql tool (part of the PostGIS distribution, I believe). This was then imported into the PostGIS database. The server-side script which generates the GeoJSON data for kothic-js was then altered to return the ST_Intersection() of the current bounding box and any coastline polygons in the area. This then returns a square of land in inland areas, or a complex polygon of land in coastal areas.
As is done in Mapnik, the canvas background was set to light blue. The land polygons from the previous step were tagged – arbitrarily – server side with “natural=land”, and then a natural=land rule added to the MapCSS. So pretty straightforward really! The updated code is now in the SVN repository.
In other developments, I have updated Freemap’s PostGIS database with OSM data current as at last weekend. However – and this will impact upon the search facility on the main, current, Mapnik-based Freemap site (0.5) as well as 0.6 – *only* data from certain counties is included. I think I have finally found a way to make Freemap sustainable with kothic-js (so many, many thanks to the kothic team!) but only if I restrict coverage to certain parts of the UK. In Southern England this includes Hampshire, West Sussex, Surrey, Wiltshire and Somerset (but not those parts which used to be Avon); the whole of Wales is covered; and in Northern England, Cheshire, Derbyshire, Lancashire and Cumbria. In this way, I have covered both my local patch and a significant proportion of the national parks and popular walking areas in the rest of England and Wales. I might experiment with adding further counties but I’d prefer to have a Freemap covering some of the UK only and working reasonably well, rather than unsustainably covering the whole country. Chrome still appears to give the best performance.
What of future plans? Freemap 0.5 (the Mapnik version) is now in feature-freeze so no new features will be added, I’m hoping to make 0.6 the default version by the spring.