将svg-polygons转换为geojson

时间:2015-04-17 13:01:37

标签: svg d3.js converter geojson topojson

我想创建一个使用svg多边形的geojson。 是否有可能将svg的像素取向多边形转移到geojson的geoiented多边形? 这是svg: http://upload.wikimedia.org/wikipedia/commons/2/2a/Deutschland_Landeskirchen_ev.svg 这是德国教堂的边界。 例如,我有这条道路:

<path xmlns="http://www.w3.org/2000/svg" style="fill:#afb1b7" d="m 282.08542,294.60292 c -0.67686,-0.81557 -2.01906,-1.62237 -2.98267,-1.79289 l -1.752,-0.31003 0.83391,-3.17551 0.83392,-3.17552 3.51611,-1.16042 3.51612,-1.16042 2.72459,-2.27723 c 1.49853,-1.25248 3.68381,-2.57722 4.85618,-2.94387 l 2.13157,-0.66663 0.60221,1.56933 0.60221,1.56934 -1.22433,1.96046 -1.22433,1.96047 -1.58514,0 -1.58514,0 -2.09424,2.25 -2.09424,2.25 -0.33007,2.99145 -0.33008,2.99145 -1.59196,0.30144 -1.59196,0.30144 -1.23066,-1.48286 z M 323,288.45671 c -2.475,-1.43771 -5.2658,-3.30373 -6.20179,-4.14672 l -1.70179,-1.5327 -3.52997,2.18164 -3.52998,2.18165 -1.03252,-0.63814 c -0.56789,-0.35098 -1.92275,-2.38312 -3.0108,-4.51587 l -1.97827,-3.87773 1.07968,-0.66728 1.07968,-0.66728 -0.50113,-1.91632 -0.50113,-1.91632 3.66401,0.65957 c 2.0152,0.36276 4.22651,1.106 4.91401,1.65162 l 1.25,0.99206 1.27429,-1.05756 1.27428,-1.05757 4.20457,0.56395 4.20457,0.56396 0.62566,3.33505 0.62566,3.33505 4.89549,-2.48073 4.89548,-2.48073 0,-1.91673 0,-1.91674 -2.72731,-0.31642 -2.72731,-0.31642 -1.71831,-4.5 -1.7183,-4.5 -0.0544,-5.58948 -0.0544,-5.58949 2.43386,-1.10894 2.43386,-1.10894 0.31614,0.88111 0.31614,0.88112 4.26051,0.39029 4.26052,0.39029 2.7942,2.67702 2.79421,2.67702 1.94528,0.0316 1.94528,0.0316 2.75,2.42044 2.75,2.42043 0,1.32546 c 0,0.729 -0.69503,2.31775 -1.5445,3.53055 l -1.54451,2.20509 1.09381,2.0438 1.09381,2.0438 -1.92497,2.72362 -1.92497,2.72361 -0.70379,3.25 -0.70379,3.25 -1.42055,0 -1.42054,0 0,1.4121 0,1.4121 -3.75,0.55867 c -2.0625,0.30726 -6.225,0.81272 -9.25,1.12325 l -5.5,0.56459 -4.5,-2.614 z M 173.5,185.04872 c -1.1,-0.41356 -2.97439,-1.08622 -4.16531,-1.4948 l -2.1653,-0.74289 -0.59826,-2.38367 -0.59827,-2.38367 -4.73643,-4.64473 -4.73643,-4.64474 2,0.56736 c 5.45006,1.54607 14.0548,4.83322 14.92204,5.70046 L 174.4,176 l 2.8,0 2.8,0 0,1.46607 c 0,1.80464 -3.15727,8.57155 -3.93521,8.43425 -0.31064,-0.0548 -1.46479,-0.43804 -2.56479,-0.8516 z" id="path3121" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:connector-curvature="0"/>

在geojson中应该是这样的:

"type": "FeatureCollection",
"features": [
{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          8.7890625,
          53.12040528310657
        ],
        [
          8.4375,
          46.55886030311719
        ],
        [
          13.0078125,
          46.800059446787316
        ],
        [
          16.875,
          49.83798245308484
        ],
        [
          10.1953125,
          52.908902047770255
        ],
        [
          8.7890625,
          53.12040528310657
        ]

......等等

那么:我如何将基于像素的svg-path(-6.20179,-4.14672)转换为geojson中的纬度/经度路径(8.7890625,53.12040528310657)?

0 个答案:

没有答案