geocodezip / geoxml3

Automatically exported from code.google.com/p/geoxml3
102 stars 87 forks source link

if url is a data URI scheme, do not guess type based on extension. #110

Closed jjimenezshaw closed 9 years ago

jjimenezshaw commented 9 years ago

To use geoxml3 with a local file, you can read it with readAsDataURL. In this case the end of the file/URL makes no sense as an extension. In case of data URI scheme, look on this data to find out if it is a KML or KMZ .

geocodezip commented 9 years ago

Do you have a simple test case that uses the new code? On Nov 28, 2015 10:48 AM, "Javier Jimenez Shaw" notifications@github.com wrote:

To use geoxml3 with a local file, you can read it with readAsDataURL. In this case the end of the file/URL makes no sense as an extension. In case of data URI scheme, look on this data to find out if it is a KML

or KMZ .

You can view, comment on, or merge this pull request online at:

https://github.com/geocodezip/geoxml3/pull/110 Commit Summary

  • if url is a data URI scheme, do not guess type based on extension.

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/geocodezip/geoxml3/pull/110.

jjimenezshaw commented 8 years ago

No. I tested directly on my webpage. Is there any testing environment for this project? In this case, I could create a few tests.

geocodezip commented 8 years ago

I don't have a testing environment (just run some regression test cases that are live on my website). Could you provide some kml/kmz files that you used to prove to yourself it works (and code to load them with readAsDataURL)?

Thank you.

On Sun, Feb 7, 2016 at 11:48 AM, Javier Jimenez Shaw < notifications@github.com> wrote:

No. I tested directly on my webpage. Is there any testing environment for this project? In this case, I could create a few tests.

— Reply to this email directly or view it on GitHub https://github.com/geocodezip/geoxml3/pull/110#issuecomment-181093663.

geocodezip commented 8 years ago

http://stackoverflow.com/questions/40310899/how-to-customise-info-window-on-multiple-polygons-google-map-v3

http://jsfiddle.net/prrayrwc/2/

Will be really grateful if someone could offer some help here. I'm not very good good with JS.

I'm trying to create multiple polygons on google map api v3. Upon clicking on each polygon, an info window (customized) will pop up. Currently I'm only able to create the polygons with the info windows but able to customize it.

[image: Currently the result looks like this.] https://i.stack.imgur.com/4EngW.png

Anyone knows how to remove the white background and the tail. I can't find the class/ID of that.

HTML

JS

var map; var infoWindow;

function initMap() {

    map = new google.maps.Map(document.getElementById('assets-map'), {
    zoom: 7,
    center: {lat: 20.3344, lng: 94.8133},
    scrollwheel: false,
    mapTypeId: 'roadmap',
    styles:

[{"featureType":"water","elementType":"geometry","stylers":[{"color":"#e9e9e9"},{"lightness":17}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#f5f5f5"},{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffffff"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#ffffff"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#ffffff"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#ffffff"},{"lightness":16}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#f5f5f5"},{"lightness":21}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#dedede"},{"lightness":21}]},{"elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#ffffff"},{"lightness":16}]},{"elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#333333"},{"lightness":40}]},{"elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#f2f2f2"},{"lightness":19}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#fefefe"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#fefefe"},{"lightness":17},{"weight":1.2}]}]

    });

    var mannFieldCoords = [
        {lat: 20.3344, lng: 94.8133},
        {lat: 20.3454, lng: 94.8539},
        {lat: 20.1698, lng: 94.8856},
        {lat: 20.1571, lng: 94.8903},
        {lat: 20.1571, lng: 94.8833},
        {lat: 20.1596, lng: 94.8820},
        {lat: 20.1541, lng: 94.8736},
        {lat: 20.1541, lng: 94.8695},
        {lat: 20.2177, lng: 94.8352}
    ];

    var a6Coords = [
        {lat: 16.7500, lng: 93.3500},
        {lat: 17.5000, lng: 93.3500},
        {lat: 17.5000, lng: 94.5167},
        {lat: 16.7500, lng: 94.3500}
    ];

    var ior4Coords = [
        {lat: 18.8083, lng: 95.2083},
        {lat: 18.8083, lng: 95.2750},
        {lat: 18.3500, lng: 95.3500},
        {lat: 18.3500, lng: 95.2667}
    ];

    var ior6Coords = [
        {lat: 18.1667, lng: 95.3000},
        {lat: 18.2833, lng: 95.3000},
        {lat: 18.2833, lng: 95.3333},
        {lat: 18.1667, lng: 95.3958}
    ];

    var mannField = new google.maps.Polygon({
        paths: mannFieldCoords,
        strokeWeight: 0,
        fillColor: '#374ea2',
        fillOpacity: 0.8

    });
    mannField.setMap(map);
    mannField.addListener('click', showArraysMF);

    var a6 = new google.maps.Polygon({
        paths: a6Coords,
        strokeWeight: 0,
        fillColor: '#374ea2',
        fillOpacity: 0.8
    });
    a6.setMap(map);
    a6.addListener('click', showArraysA6);

    var ior4 = new google.maps.Polygon({
        paths: ior4Coords,
        strokeWeight: 0,
        fillColor: '#374ea2',
        fillOpacity: 0.8
    });
    ior4.setMap(map);
    ior4.addListener('click', showArraysIor4);

    var ior6 = new google.maps.Polygon({
        paths: ior6Coords,
        strokeWeight: 0,
        fillColor: '#374ea2',
        fillOpacity: 0.8
    });
    ior6.setMap(map);
    ior6.addListener('click', showArraysIor6);

    infoWindow = new google.maps.InfoWindow;

}

function showArraysMF(event) {

    var vertices = this.getPath();

    var contentString = '<div id="iw_container">' +
      '<div class="iw_title">Mann Field <span>(52 sq-km)</span></div>' +
      '<div class="iw_content">Performance Compensation Contract

since 1996, extended for 11 years until August 2024

' + "<i class='fa fa-arrow-right' aria-hidden='true'>" '
';

    infoWindow.setContent(contentString);
    infoWindow.setPosition(event.latLng);
    infoWindow.open(map);
}

function showArraysA6(event) {

    var vertices = this.getPath();

    var contentString = '<div id="iw_container">' +
      '<div class="iw_title">A-6 <span>(9830 sq-km)</span></div>' +
      '<div class="iw_content">PSC signed in 2007, Pyi Thar-1

first gas discovery in Rakhine Foldbelt of Myanmar deepwaters' + "<i class='fa fa-arrow-right' aria-hidden='true'>" '';

    infoWindow.setContent(contentString);
    infoWindow.setPosition(event.latLng);
    infoWindow.open(map);
}

function showArraysIor4(event) {

    var vertices = this.getPath();

    var contentString = '<div id="iw_container">' +
      '<div class="iw_title">IOR-4 <span>(380 sq-km)</span></div>' +
      '<div class="iw_content">Brown field, re-development project

governed by IPR contract' + "<i class='fa fa-arrow-right' aria-hidden='true'>" '';

    infoWindow.setContent(contentString);
    infoWindow.setPosition(event.latLng);

    infoWindow.open(map);
}

function showArraysIor6(event) {

    var vertices = this.getPath();

    var contentString = '<div id="iw_container">' +
      '<div class="iw_title">IOR-6 <span>(116 sq-km)</span></div>' +
      '<div class="iw_content">Brown field, re-development project

governed by IPR contract' + "<i class='fa fa-arrow-right' aria-hidden='true'>" '';

    infoWindow.setContent(contentString);
    infoWindow.setPosition(event.latLng);

    infoWindow.open(map);
}

google.maps.event.addDomListener(window, 'load', initialize);

Sorry for the bad usage of JS.

A codepen http://codepen.io/lesliehui/pen/wzbOrQ exmaple of my work.

I tried following the tutorial http://en.marnoto.com/2014/09/5-formas-de-personalizar-infowindow.html on this but map doesnt show up.