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

Keep KML placemarks with missing coordinates #95

Closed
hyperknot opened this issue Oct 20, 2022 · 4 comments
Closed

Keep KML placemarks with missing coordinates #95

hyperknot opened this issue Oct 20, 2022 · 4 comments

Comments

@hyperknot
Copy link

First of all, thanks for giving the much needed love to this library in the recent months! It became so good now that I decided to deprecate my LibKML / GDAL fallback code and only use togeojson for KML imports.

There is only one issue I have with this library, is that it silently drops KML items without valid coordinates. Now this might sound like an edge case, but Google My Maps is exporting more and more maps without coordinates.

I did some experimenting and for a few items on a map added via "Add to Map" it still allows exporting with coordinates, but I've seen reports that with hundreds of items it simply disables coordinate export. It also disables coordinate export for all items which were imported from a CSV.

For example this is how it looks online, showing coordinates:

image

Whereas this is what is exported:

<Placemark>
  <name>Sherlock Holmes</name>
  <address>221B Baker Street, London</address>
  <description>221B Baker Street, London</description>
  <styleUrl>#icon-1899-0288D1</styleUrl>
</Placemark>

I've created a sample map with both type of items. Here is the KML export (renamed to .txt for GitHub):

KML export test.txt

Right now, togeojson silently drops these items. I'd like to ask to please don't drop these, but add them with null geometry. From the GeoJSON specs, I found this:

The value of the geometry member SHALL be either a Geometry object as 
defined above or, in the case that the Feature is unlocated, a JSON null value.

I think this is exactly the case we are talking here, "unlocated" features.

@tmcw
Copy link
Collaborator

tmcw commented Oct 21, 2022

Hi,

Thanks for the issue! I can't replicate this problem: for example, here's your example run through togeojson - https://observablehq.com/d/1c3388b177640bb7

There are 3 features in, 3 out, with one having a null geometry. Seeing the same results running the example as a testcase. As far as I can tell, this has been the case for a while - if there are no geometries in a Placemark element, then it'll output a Feature in GeoJSON with a null geometry. Are you sure you're using a recent version of this code and that the items are actually being dropped? It doesn't seem like at least the @tmcw/togeojson package, with the .kml method, has that behavior.

@tmcw
Copy link
Collaborator

tmcw commented Oct 26, 2022

Ping @hyperknot - is there a testcase that demonstrates this limitation that you can share?

@hyperknot
Copy link
Author

hyperknot commented Oct 26, 2022

@tmcw you are right, the example I thought would be a minimal repro case does produce the null geometry correctly.

I'm looking more into the Google My Maps export, it's still not clear to me how it works. (For example it creates a totally different CSV based on how the point was created. Also their CSV is super trivally broken, the commas are not escaped, for example).

@tmcw
Copy link
Collaborator

tmcw commented Oct 31, 2022

Okay - closing for now, feel free to open a new issue when this gets narrowed down into a reproducible testcase!

@tmcw tmcw closed this as completed Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants