I modified this question to reflect some progress in detecting a problem. I am using the following python code to create continental USA SVG. The form file does not matter, because the problem I am describing is happening no matter which shapefile I am using. The script is really simple. I basically just take the shapefile for the USA and use the bounding box to exclude Hawaii and Alaska.
from kartograph import Kartograph K = Kartograph() blah={ "layers": [ { "id":"mylayer", "src":"/Users/austinc/Documents/shapefiles/states_21basic/states.shp", } ], "bounds":{ "mode":"bbox", "data":[-130,25,-65,50], }, "proj":{ "id":"mercator" } } K.generate(blah,outfile='/Users/austinc/Desktop/mymap.svg')
The problem is that the svg generated by this code has the wrong coordinates associated with it. When I use javascript to try to match the points on it, the points appear at the correct latitude, but are turned off by about 100 degrees longitude.
When I use the pre-prepared SVG from Kartograph, I do not have this problem (I have not tried to trim Alaska and Hawaii yet). So something about my python script calls this, but I don't understand what.
FIXED: the comment below made me think that maybe this has something to do with projection. I removed the part of the python script that draws the graph as a projection of the Mercator, and that fixes everything. I'm not sure I understand why, but if you have a similar problem and find this question: try changing the projection or not using the projection at all.
source share