Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A possible issue with Multi-geometries and Name and Description inside KML Plugin? #215

Open
ismail44 opened this issue Mar 28, 2016 · 14 comments
Labels

Comments

@ismail44
Copy link

(Using KML Plugin version from Master)

We have an internal service that creates a KML which we try to display on our map. This KML has a name and description element inside of a Placemark that is defined as a Multigeometry. It seems that inside the parsePlacemark it recurses back into the parsePlacemark function with the "Multi-type" elements. These elements, subsequently don't have the Name and/or Description fields.

Is this non-standardized KML which I just have to account for, or is this an issue with the KML plugin?

I do not have a KML sample which I can post here as it's on a closed system. I could, however, try to fashion a sample, but basically it's just a <Placemark> element with <Name> and <Description> and <Multigeometry> and children (at the same level).

Thanks.

@brunob
Copy link
Collaborator

brunob commented Mar 28, 2016

You should have a look at KML specs and provide a jsfiddle reproducing the bug ;)

@ismail44
Copy link
Author

I looked at the KML specs and while the words appear to be in English, I
don't think they are. I'll see if I can find a few minutes to throw up a
fiddle. I was more curious than anything. And, like I said... the KML we
have is on a closed network that I CANNOT make public, so it's going to be
very difficult for me to do this. But, I'll see what I can do.

On Mon, Mar 28, 2016 at 9:42 AM, b_b notifications@github.com wrote:

You should have a look at KML specs and provide a jsfiddle reproducing the
bug ;)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#215 (comment)

@ismail44
Copy link
Author

Also, is there a reason the description is not shown if there's no name for
the Placemark?

On Mon, Mar 28, 2016 at 9:45 AM, Bill Oberacker bill.oberacker@gmail.com
wrote:

I looked at the KML specs and while the words appear to be in English, I
don't think they are. I'll see if I can find a few minutes to throw up a
fiddle. I was more curious than anything. And, like I said... the KML we
have is on a closed network that I CANNOT make public, so it's going to be
very difficult for me to do this. But, I'll see what I can do.

On Mon, Mar 28, 2016 at 9:42 AM, b_b notifications@github.com wrote:

You should have a look at KML specs and provide a jsfiddle reproducing
the bug ;)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#215 (comment)

@brunob
Copy link
Collaborator

brunob commented Mar 28, 2016

Also, is there a reason the description is not shown if there's no name for the Placemark?

Mainly historical reason, see :

https://github.com/shramov/leaflet-plugins/blob/master/layer/vector/KML.js#L289

Maybe we can change this, feel free to provide a pull request for that.

@ismail44
Copy link
Author

Thanks!

I am trying to create a fiddle for the original issue... how do I add your KML plugin? Is there a CDN link?

@brunob
Copy link
Collaborator

brunob commented Mar 28, 2016

No CDN for now, there is a PR for that on cdnjs/cdnjs#6137 but it's done yet, so you have to use direct link to raw file from here.

@ismail44
Copy link
Author

Here is the fiddle for the initial question:

http://fiddle.jshell.net/kybp2dcd/32/

The KML with name and description OUTSIDE of the multigeometry is at:

https://gist.githubusercontent.com/ismail44/880dfedaed05186f14ff/raw/58a6c986cc50bb21a9eaea5d5f2d534fe0fed234/gistfile1.txt

When you try to click on the marker (or the polygon) you don't see the name or description.

Thanks.

@brunob
Copy link
Collaborator

brunob commented Mar 28, 2016

Hmm strange but your fiddle doesn't show any map... am i missing something ?

@ismail44
Copy link
Author

For some reason there's an SSL error on the site for the leaflet code. Let
me see what I can do.

On Mon, Mar 28, 2016 at 11:53 AM, b_b notifications@github.com wrote:

Hmm strange but your fiddle doesn't show any map... am i missing something
?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#215 (comment)

@ismail44
Copy link
Author

I removed the "https" bits... try this link:

https://fiddle.jshell.net/kybp2dcd/38/

On Mon, Mar 28, 2016 at 12:00 PM, Bill Oberacker bill.oberacker@gmail.com
wrote:

For some reason there's an SSL error on the site for the leaflet code. Let
me see what I can do.

On Mon, Mar 28, 2016 at 11:53 AM, b_b notifications@github.com wrote:

Hmm strange but your fiddle doesn't show any map... am i missing
something ?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#215 (comment)

@brunob
Copy link
Collaborator

brunob commented Mar 28, 2016

Still no map...

@ismail44
Copy link
Author

HMMM

Then I don't really know what to do. Is there a fiddle you use when demoing
(with leaflet v.0.7.7) that I can clone?

On Mon, Mar 28, 2016 at 1:57 PM, b_b notifications@github.com wrote:

Still no map...


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#215 (comment)

@ismail44
Copy link
Author

Can you verify that when you go to the fiddle you are connecting to fiddle.net over the standard http port and not the https port? (Meaning, make sure it's http and not https). I just realized I copied the wrong address... try this one:

http://fiddle.jshell.net/kybp2dcd/38/

@brentfraser
Copy link

I have the same problem. I'm using the url: http://gis.hamweather.net/kml/hwadv_all.kml fi you want to reproduce the problem. So I hacked the parsePlacemark function to remove the recursion (after line 247):

        var layers = [];

        var multi = ['MultiGeometry', 'MultiTrack', 'gx:MultiTrack'];
        for (h in multi) {
            el = place.getElementsByTagName(multi[h]);
            for (i = 0; i < el.length; i++) {
//              return this.parsePlacemark(el[i], xml, style, opts);
                var parse = ['LineString', 'Polygon', 'Point', 'Track', 'gx:Track'];
                for (j in parse) {
                    var tag = parse[j];
                    el = place.getElementsByTagName(tag);
                    for (i = 0; i < el.length; i++) {
                        var l = this['parse' + tag.replace(/gx:/, '')](el[i], xml, opts);
                        if (l) { layers.push(l); }
                    }
                }
            }
        }

I'm not sure if this conforms to the KML spec...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants