2017-02-23 104 views
-1

Я попытался преобразовать этот образ SVG Stockholm City border SVG (граница города Стокгольма) в Google map Polygon.SVG to Google Map Polygon

Но окончательный полигон не в порядке. Существует код:

var width = 735, // width of SVG 
 
height = 682; // height of SVG 
 

 
function toLongitude(x) { 
 
    return x/height + 18.0780778; 
 
} 
 

 
function toLatitude(y) { 
 
    return y/width + 59.3325755; 
 
} 
 

 

 
function onLoad() { 
 
    // The SVG path; 
 
    var path = "M735.4,682.4 l0-1.2-0.2-2,0-2.5l1.5-2.9,0.3-6,1.3-9l0.9-2.8,0.1-5.8,0.7-8.8 l0.6-3.3,0.3-6.8,0.9-10.2l0.4-2.4-0.5-4.9,0.8-7.2l-0.6-3.1,0.7-5.7,2.7-8.1l0.4-0.5,0.6-1.2,0.9-1.9l-2.8,0.2-5.2,0.2-7.7,0.6 l-4.1,0.7-8.2,1.4-12.2,2.5l-0.8,0.2-2.1,0.4-2.7,0l-1-0.7-2.2,0-2.8-0.4l-1.8-2.1-3.6-3.9-4.9-5.9l-0.8-1.2-2.3-2.1-2.3-3.9 l0-1.2-1.1-2.5-1.6-3.4l-2-0.9-3.9-1.8-5.8-2.7l1-3.2-2-6.3,0-9.5l-2.7-3.5-2-7.5-2.1-11.4l1.5-1.2,0.6-2.7,0.7-4.1 l0.1-1.4,0-2.9,0-4.1l-9-2.7-17.7-5.3-26.3-7.9l-0.3-0.1-0.5-0.5-0.8-0.7l-0.7-3.6,0.7-7.3-0.8-10.7l0.4-1,0.8-2,1.2-3 l-0.1-0.1-0.6-0.4-0.6-0.6l0.5-2.9,1.2-5.8,2.2-8.4l-1.8-2.5-3.5-4.8-5.2-7.1l-0.7-1-1.5-1.9-2.3-2.9l-0.9-1-2-1.9-2.5-3.1 l-0.5-1.3-1.8-1.5-2.7-2.3l-4.1-3.7-7.8-7.7-12.4-10.8l-2-1.4-3.6-3.3-5.5-5l-2.1-1.8-3.9-3.9-6.4-5.3l-1.4-0.8-2.7-2.3-3.4-3.7 l-1.6-3.3-2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1.7-0.6,2.2-0.8l0.4-0.8,0.7-1.4,1-1.9l-1.2-1.9-1.3-4.3-2.9-6.1l-0.6-0.7-0.9-1.9-0.7-2.7l0.5-2.2,1.5-4.4,2.1-6.6 l0.3-1,0.3-2,1.5-2.2l1.3,0.6,2.6,1.1,4,1.7l0.8-0.9,1.5-1.7,2-2.4l0.6,0.4,1,0.6,1.3,0.8l2.1-1.5,4-2.9,5.7-4.2 l2.4,1.3,4.5,2.3,6.5,3.5l3.4,1.9,7,3.6,10.3,5.6l3.1,1.9,6.5,3,9.9,4.4l3.3,1.3,6.9,2.1,10.3,3.4l3.3,1.3,6.9,2.2,10.3,3.4 l4.9,1.7,9.7,3.5,14.7,4.9l0.3,0.8,0.6,1.6,0.9,2.4l0.3,1.2,1.2,1.8,2.4,2.2l4.6,1.7,9.3,3.4,13.9,5.1 C731.8,681.6,733.4,681.9,735.4,682.4z"; 
 

 
    var points = path.match(/(\d+)/g); 
 
    var mapOptions = { 
 
     zoom: 11, 
 
     center: new google.maps.LatLng(59.3325755, 18.0780778), 
 
     mapTypeId: google.maps.MapTypeId.TERRAIN 
 
    }; 
 
    var map = new google.maps.Map(document.getElementById("map"), 
 
            mapOptions); 
 

 
    // Map polygon coordinates 
 
    var polyCoordinates = []; 
 
    for (var i = 0; i < points.length; i += 2) { 
 
     var longitude = toLongitude(parseInt(points[i])), 
 
      latitude = toLatitude(parseInt(points[i + 1])); 
 
     console.log(latitude + ', ' + longitude); 
 
     polyCoordinates.push(new google.maps.LatLng(latitude, longitude)); 
 
    } 
 

 
    var polygon = new google.maps.Polygon({ 
 
     paths: polyCoordinates, 
 
     strokeColor: '#000000', 
 
     strokeOpacity: 1, 
 
     strokeWeight: 1, 
 
     fillColor: '#ffff99', 
 
     fillOpacity: 0.85 
 
    }); 
 

 
    polygon.setMap(map); 
 
}
#map{ 
 
\t height: 100 %; 
 
} 
 
html, body{ 
 
\t height: 100 %; 
 
\t margin : 0; 
 
\t padding : 0; 
 
}
<body> 
 
    <div id="map"></div> 
 
    <script src="https://maps.googleapis.com/maps/api/js?callback=onLoad" async defer></script> 
 
</body>

От SVG изображения Я извлек путь от пути id="City_border", удалить абсолютные координаты с самого начала и в конце пути SVG и заменить «с» с «L» (кривая к линиям).

Но я сделал что-то не так.

Любая идея?

+0

Тот же результат, если я с помощью «C» вместо «л» – sasa

ответ

0

Ваш код кажется не в порядке с полигона, Попробуйте это указывает:

<!DOCTYPE html> 
 
<html> 
 
<body> 
 

 
<svg height="1000" width="1000"> 
 
    <polygon points="735.400 682.400, 735.400 679.900, 736.700 670.900, 737.400 662.100, 738.300 651.900, 739.100 644.700, 741.800 636.600, 742.700 634.700, 735.000 635.300, 722.800 637.800, 720.100 637.800, 717.300 637.400, 712.400 631.500, 710.100 627.600, 708.500 624.200, 702.700 621.500, 702.700 612.000, 700.600 600.600, 701.300 596.500, 701.300 592.400, 675.000 584.500, 674.200 583.800, 673.400 573.100, 674.600 570.100, 674.000 569.500, 676.200 561.100, 671.000 554.000, 668.700 551.100, 666.200 548.000, 663.500 545.700, 651.100 534.900, 645.600 529.900, 639.200 524.600, 635.800 520.900, 632.000 510.500, 631.200 506.300, 643.700 488.500, 644.600 486.700, 642.100 487.300, 638.000 486.700, 629.200 486.700, 627.400 487.400, 618.300 484.000, 621.000 482.200, 621.000 479.700, 623.000 478.100, 621.800 471.800, 621.800 465.100, 619.400 461.900, 617.300 459.400, 614.300 454.600, 611.600 451.200, 616.400 446.600, 618.300 440.100, 622.900 440.100, 629.200 439.400, 633.400 438.100, 637.300 438.400, 640.700 438.500, 647.600 434.900, 651.300 434.200, 655.100 433.600, 657.400 433.500, 662.100 434.600, 667.200 435.400, 674.900 437.400, 689.400 429.700, 689.400 427.800, 693.300 417.400, 693.700 415.300, 690.000 409.100, 690.000 395.800, 674.800 381.900, 661.800 370.700, 660.000 369.700, 657.000 368.200, 644.600 361.500, 641.800 359.600, 637.600 353.800, 625.100 335.500, 622.400 332.200, 621.300 324.700, 619.600 321.700, 610.200 311.000, 603.500 303.400, 600.000 299.700, 594.800 298.200, 581.300 295.400, 578.000 294.500, 574.800 292.700, 571.600 290.000, 565.500 285.900, 557.200 285.100, 553.400 284.500, 549.300 283.900, 538.600 283.200, 537.900 283.200, 529.300 283.200, 525.900 284.200, 525.200 287.600, 525.800 291.000, 518.600 293.500, 517.900 296.600, 525.000 308.600, 525.800 310.700, 530.800 325.000, 533.100 335.600, 528.200 340.200, 527.100 348.700, 523.100 352.900, 521.700 350.000, 519.600 350.800, 512.900 355.500, 506.000 361.400, 501.000 367.200, 500.000 372.600, 499.900 378.300, 498.500 381.800, 496.500 381.200, 490.600 381.200, 483.500 378.600, 470.700 376.400, 466.000 378.500, 461.100 379.800, 459.300 378.200, 452.200 372.900, 438.800 365.700, 436.200 364.200, 431.900 357.000, 428.800 354.800, 425.500 352.400, 416.400 343.300, 415.200 340.700, 409.300 326.700, 407.200 323.100, 404.200 318.500, 400.600 315.100, 396.800 311.900, 393.100 309.000, 393.900 308.100, 386.000 303.800, 384.900 300.300, 382.400 297.200, 379.100 294.800, 372.800 291.700, 363.400 286.500, 361.200 285.100, 362.900 282.200, 361.400 279.500, 368.200 270.400, 369.200 270.100, 372.700 264.700, 374.100 258.900, 376.700 254.600, 378.300 254.600, 382.800 252.200, 383.000 251.400, 391.000 236.200, 394.200 227.600, 397.300 222.700, 400.600 219.400, 408.500 215.300, 411.700 215.600, 411.700 213.500, 422.300 208.800, 424.000 210.800, 425.400 211.300, 408.100 195.500, 407.800 195.300, 399.800 189.300, 394.500 185.500, 385.600 179.800, 368.400 166.600, 365.600 164.700, 363.700 166.300, 353.500 154.500, 351.300 148.000, 343.600 141.900, 345.400 136.100, 349.000 126.300, 349.900 122.300, 344.600 117.900, 340.500 117.900, 339.400 116.900, 339.400 115.200, 333.600 112.000, 333.200 113.200, 328.300 111.500, 328.300 108.100, 326.600 105.700, 322.700 105.700, 316.300 112.400, 315.800 113.200, 313.600 121.500, 311.600 126.100, 309.500 127.500, 310.000 127.900, 308.900 132.500, 311.300 134.300, 311.300 136.300, 317.200 143.300, 311.900 147.300, 314.200 149.700, 316.500 152.300, 317.100 158.000, 322.300 170.600, 322.300 172.600, 319.900 174.400, 319.300 180.300, 317.700 184.100, 313.000 191.100, 308.500 197.100, 297.000 204.300, 293.200 205.800, 288.400 205.900, 284.000 209.900, 290.100 216.600, 291.900 221.000, 288.400 223.900, 284.800 227.800, 281.300 226.200, 278.600 232.800, 273.900 238.800, 269.600 243.600, 264.800 244.400, 257.500 247.800, 253.300 251.600, 244.000 260.600, 239.500 266.400, 227.900 267.400, 216.800 265.900, 216.900 262.400, 217.500 258.600, 218.200 254.800, 218.800 249.600, 219.800 238.000, 218.300 236.600, 211.800 227.200, 210.100 224.500, 206.500 219.500, 203.600 221.500, 201.000 224.700, 198.400 227.700, 192.300 232.800, 181.700 241.600, 180.700 241.600, 153.400 220.300, 128.700 237.900, 129.200 239.300, 133.400 247.200, 141.500 253.900, 142.700 254.500, 149.900 262.200, 157.900 277.400, 163.300 287.500, 167.500 296.000, 166.800 305.300, 167.000 306.500, 170.400 316.400, 174.100 327.800, 175.900 333.000, 178.300 332.800, 186.400 330.300, 200.300 326.900, 204.500 326.300, 217.700 336.700, 218.300 339.600, 226.500 349.000, 237.400 345.800, 243.400 346.900, 248.100 350.500, 256.300 356.000, 263.600 360.900, 269.500 365.700, 274.700 371.400, 282.200 379.800, 283.800 381.000, 288.700 382.600, 293.100 385.700, 295.900 389.800, 307.100 396.700, 314.300 394.500, 331.800 410.600, 333.600 412.200, 350.100 422.100, 359.000 427.800, 371.400 434.600, 379.400 439.600, 391.100 449.600, 400.300 460.200, 390.700 472.100, 378.100 474.000, 375.000 478.800, 369.600 481.900, 365.000 481.900, 361.000 481.900, 358.200 483.900, 349.800 488.000, 343.700 490.000, 338.800 491.400, 332.700 497.400, 326.000 503.500, 318.400 507.100, 312.600 509.300, 310.200 511.900, 306.700 519.000, 301.500 523.800, 289.500 525.800, 277.200 528.100, 277.900 539.400, 278.300 540.200, 278.300 546.700, 274.800 554.800, 273.300 558.600, 278.900 560.800, 284.300 562.900, 288.300 572.500, 292.100 575.400, 298.900 570.600, 306.500 570.600, 306.900 570.900, 306.900 573.900, 312.300 573.900, 313.500 578.600, 319.000 578.600, 326.600 575.300, 333.700 573.600, 338.800 563.600, 341.300 556.100, 343.900 549.400, 344.500 548.900, 349.100 545.400, 362.900 534.600, 370.900 531.200, 380.300 526.800, 388.900 523.000, 390.900 522.500, 390.100 527.200, 392.900 526.400, 394.400 527.600, 393.500 530.000, 403.000 537.600, 403.600 543.300, 403.000 551.800, 402.200 556.200, 401.600 560.100, 403.600 564.700, 409.900 573.000, 413.000 575.700, 414.000 576.000, 421.700 580.300, 424.500 582.600, 429.600 587.000, 437.600 592.000, 444.300 592.000, 446.400 592.200, 452.400 594.300, 469.100 601.300, 479.600 608.100, 485.400 608.100, 487.700 610.800, 490.000 610.800, 493.500 617.700, 502.100 624.900, 503.700 626.300, 504.800 627.000, 513.000 630.200, 530.100 637.300, 533.600 637.800, 536.700 634.100, 552.700 651.200, 551.300 652.500, 551.000 659.100, 554.200 657.400, 554.500 654.800, 556.400 654.800, 557.500 656.700, 563.300 664.600, 572.700 673.400, 573.200 673.900, 579.400 676.400, 587.500 677.300, 613.600 686.800, 614.800 682.300, 630.700 675.000, 631.700 671.600, 634.200 670.500, 636.400 669.700, 637.400 667.800, 634.500 661.700, 633.800 659.000, 635.900 652.400, 637.400 650.200, 641.400 651.900, 643.400 649.500, 644.700 650.300, 650.400 646.100, 656.900 649.600, 667.200 655.200, 677.100 659.600, 687.400 663.000, 697.700 666.400, 712.400 671.300, 713.300 673.700, 715.700 675.900, 729.600 681.000, 735.400 682.400" style="fill:white;stroke:black;stroke-width:2" /> 
 
</svg> 
 

 
</body> 
 
</html>