I have modified this question to reflect some progress on discovering the problem. I am using the following python code to generate an SVG of the continental USA. The shapefile is irrelevant, as the problem I describe occurs regardless of what shapefile I use. The script is really simple. I basically just take a shapefile for the US and use a 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 incorrect coordinates associated with it. When I use javascript to try to map points on it, the points appear at the correct latitude, but are off by roughly 100 degrees of longitude.
When I use a pre-made SVG from Kartograph, I do not have this problem (I have not tried cropping away Alaska and Hawaii yet). So something about my python script is causing this but I don't understand what.
FIXED: The comment below got me thinking that maybe this was something to do with the projection. I removed the part of the python script that draws the graph as a mercator projection and this fixed everything. I'm not sure I understand why but if you are having a similar issue and find this question: try changing your projection or not using a projection at all.