I'm new to Kartograph and am trying to use it to create locator maps for towns in New York State. I've been encountering some rendering problems when line layers are involved. The Python code to generate one such map (including the configuration) is as follows:
from kartograph import Kartographimport sysK = Kartograph()css = open("styles.css").read()cfg = { "layers": { "municipalities": { "src": "D:/GIS/NY/cb_2013_36_cousub_500k/cb_2013_36_cousub_500k.shp", }, "hydrography": { "src": "D:/GIS/NY/hydrography_shp/AreaHydrography_over100k.shp", }, "counties_water": { "src": "D:/GIS/NY/tl_2014_county_ny_line.shp", }, "prisecroads15": { "src": "D:/GIS/NY/tl_2015_36_prisecroads/tl_2015_36_prisecroads.shp", } }, "proj": { "id": "mercator" }, "bounds": { "mode": "bbox", "data": [-80.0, 41.9, -78.8, 42.7], "crop": [-80.0, 41.9, -78.8, 42.7] }}K.generate(cfg, outfile='out.svg', stylesheet=css)Of the source shapefiles, municipalities and hydrography are polygon-based, while counties_water and prisecroads15 are line-based. The associated CSS file is:
#prisecroads15[MTFCC=S1100] { stroke: #FFCC00; stroke-width: 2.25px; stroke-opacity: 1.0;},#prisecroads15[MTFCC=S1200] { stroke: #C59266; stroke-width: 1.4px; stroke-opacity: 1.0;},#municipalities { fill: #E4E4D1; stroke: #646464; stroke-width: 2.0px; stroke-opacity: 1.0;},#municipalities[COUSUBFP=\31 \31 \34 \35 \31 ] { fill: #B00000;},#hydrography { fill: #C6ECFF; stroke: #0978AB; stroke-width: 1.0px; stroke-opacity: 1.0;},#counties_water { stroke: #000000; stroke-width: 2.0px; stroke-opacity: 1.0;}The layers should be drawn in the order specified in cfg. However, the resulting svg has a different layer order: prisecroads15 < hydrography < municipalities < counties_water.
Incidentally, I have found that introducing another layer (call it prisecroads) in cfg immediately before prisecroads15, from the same source tl_2015_36_prisecroads.shp, results in the latter being pushed to the top of the stack in the svg, as desired, but the order of the other layers is still messed up. In this case the layer order is: prisecroads < hydrography < municipalities < counties_water < prisecroads15.
Could anyone provide insight on why the layers are being scrambled? I've tried generating maps from polygon layers only and they seem to render just fine.
أكثر...
from kartograph import Kartographimport sysK = Kartograph()css = open("styles.css").read()cfg = { "layers": { "municipalities": { "src": "D:/GIS/NY/cb_2013_36_cousub_500k/cb_2013_36_cousub_500k.shp", }, "hydrography": { "src": "D:/GIS/NY/hydrography_shp/AreaHydrography_over100k.shp", }, "counties_water": { "src": "D:/GIS/NY/tl_2014_county_ny_line.shp", }, "prisecroads15": { "src": "D:/GIS/NY/tl_2015_36_prisecroads/tl_2015_36_prisecroads.shp", } }, "proj": { "id": "mercator" }, "bounds": { "mode": "bbox", "data": [-80.0, 41.9, -78.8, 42.7], "crop": [-80.0, 41.9, -78.8, 42.7] }}K.generate(cfg, outfile='out.svg', stylesheet=css)Of the source shapefiles, municipalities and hydrography are polygon-based, while counties_water and prisecroads15 are line-based. The associated CSS file is:
#prisecroads15[MTFCC=S1100] { stroke: #FFCC00; stroke-width: 2.25px; stroke-opacity: 1.0;},#prisecroads15[MTFCC=S1200] { stroke: #C59266; stroke-width: 1.4px; stroke-opacity: 1.0;},#municipalities { fill: #E4E4D1; stroke: #646464; stroke-width: 2.0px; stroke-opacity: 1.0;},#municipalities[COUSUBFP=\31 \31 \34 \35 \31 ] { fill: #B00000;},#hydrography { fill: #C6ECFF; stroke: #0978AB; stroke-width: 1.0px; stroke-opacity: 1.0;},#counties_water { stroke: #000000; stroke-width: 2.0px; stroke-opacity: 1.0;}The layers should be drawn in the order specified in cfg. However, the resulting svg has a different layer order: prisecroads15 < hydrography < municipalities < counties_water.
Incidentally, I have found that introducing another layer (call it prisecroads) in cfg immediately before prisecroads15, from the same source tl_2015_36_prisecroads.shp, results in the latter being pushed to the top of the stack in the svg, as desired, but the order of the other layers is still messed up. In this case the layer order is: prisecroads < hydrography < municipalities < counties_water < prisecroads15.
Could anyone provide insight on why the layers are being scrambled? I've tried generating maps from polygon layers only and they seem to render just fine.
أكثر...