Can't pull map.js from cartagen.org
alyxb opened this issue · 3 comments
Tried to select a sample of map data by using the rectangle selector,
but the link:
seems to be 404'd. So, without installing a Cartagen server, how can I
obtain the JSON for that area?
As of the forking of MapKnitter from Cartagen, I no longer operate a full planet server at http://cartagen.org. I'm really sorry but it was too much effort on my end; the planet is over 700gb and it takes a lot of CPU and bandwidth to do it.
This means your options are:
- install your own planet server
- convince the OSM devs to pull in some of my modifications to the OSM rails port (https://github.com/jywarren/openstreetmap-website), which probably means writing some tests for them
- write a GeoJSON or GeoRSS parser (based on the NEWSFLOW code) so we can end-run around this limitation
- hit the OSM API for XML data and convert it following these suggestions:
- https://github.com/hay/xml2json - python based
- someone could write a web-based XML->JSON parser and run it as a service so you can download OSM-XML and convert it online
I personally used: http://jsontoxml.utilities-online.info/
It worked fine, except the keys were prefixed with '-' characters.
A quick find/replace worked like a charm.
I'll report here what I did, maybe useful for others trying to get this working
I got it pretty close to working but not completely
-
Download the project code from github (clone) and unzip.
-
Drop the index.html into safari. You will notice that it does not work. That is because of cross-origin restriction.
-
Go to safari develop menu and select "Disable cross-origin restrictions". Now the default map (of rome) should if you refresh the page.
-
Download a map from https://download.geofabrik.de/europe.html
I took the Isle of Man map as it is small. Take the .osm.bz2 so that you can easily extract the plain .osm map -
Go to http://www.utilities-online.info/xmltojson/#.Xtos0lDLcTs and copy the xml data in. Wait a few minutes. Copy the json data out and put it in a file
-
Edit the file in a text editor and replace all "- with " (remove all minuses after quotes). As movermeyer indicated, there seems no reason to have these minuses there
-
Copy the file into samples/data
-
Determine the map middle : open the json file or xml file. You will see at the top the map bounds minlat="53.73236" minlon="-5.434554" maxlat="54.6706" maxlon="-3.688718/>. Take some point inside this bounds. In this case, lat=54, lng=-4 would work
-
Edit index.html and put a ref to the json file in in the section "Carthagen.setup". You can comment out/disable the rome stuff. Also change the "lat" and "lng" position to somewhere in the middle of your map.
-
Reload the map
-
I got some vectors at this point, but I also get some error messages in the console and the map stays mostly empty.
The console error is:
cartagen.js : 624 : TypeError: undefined is not an object (evaluating 'this.coastline_nodes.first()[0]')