Jump to content

 
Photo

KML import to MAPublisher?

- - - - -

  • Please log in to reply
13 replies to this topic

#1
David Medeiros

David Medeiros

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,069 posts
  • Gender:Male
  • Location:Redwood City CA
  • Interests:Cartography, wood working, wooden boats, fishing, camping, overland travel, exploring.
  • United States

I have a small KML file that I need to import into MAPub. I can successfully import the file but when I do all I get is a new Map View with no data or line work. The KML opens in Google Earth so I know it's valid. Any ideas?

Thanks,

Dave

GIS Reference and Instruction Specialist, Stanford Geospatial Center.

 

www.mapbliss.com

 


#2
Hans van der Maarel

Hans van der Maarel

    CartoTalk Editor-in-Chief

  • Admin
  • PipPipPipPipPipPipPip
  • 3,856 posts
  • Gender:Male
  • Location:The Netherlands
  • Interests:Cartography, GIS, history, popular science, music.
  • Netherlands

I have a small KML file that I need to import into MAPub. I can successfully import the file but when I do all I get is a new Map View with no data or line work. The KML opens in Google Earth so I know it's valid. Any ideas?


Any chance I could get a copy that KML file? (hans-at-redgeographics-dot-com)

The thing with KML is that it may or may not be structured very well. Does it open in Google Earth?
Hans van der Maarel - Cartotalk Editor
Red Geographics
Email: hans@redgeographics.com / Twitter: @redgeographics

#3
David Medeiros

David Medeiros

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,069 posts
  • Gender:Male
  • Location:Redwood City CA
  • Interests:Cartography, wood working, wooden boats, fishing, camping, overland travel, exploring.
  • United States

I have a small KML file that I need to import into MAPub. I can successfully import the file but when I do all I get is a new Map View with no data or line work. The KML opens in Google Earth so I know it's valid. Any ideas?


Any chance I could get a copy that KML file? (hans-at-redgeographics-dot-com)

The thing with KML is that it may or may not be structured very well. Does it open in Google Earth?


KML and link to original Google Map on the way.

It does open in GE and I've tried re saving it from GE but no luck. The file was originally taken from a Google Maps link sent to me by a client.

GIS Reference and Instruction Specialist, Stanford Geospatial Center.

 

www.mapbliss.com

 


#4
James Hines

James Hines

    James Anthony Hines

  • Validated Member
  • PipPipPipPipPipPip
  • 535 posts
  • Gender:Male
  • Location:Centreville, Nova Scotia
  • Interests:Cartography, Philosophy, Politics, Psychology, Economics, Occultism, Spiritualism
  • Canada

Zoom out to the furthest extent, select the layer where the KML is on, & if I'm correct you will see the KML way off the board shown as a dot. What this means is that your projection is incorrect & incompatible with your map view. Just keep in mind that KML can only be projected in Lat/Lon or in Arc terms the geographic projection.

"There is much beauty that we fail to see through our own eyes teeming with life forms that give us that perception of our reality.  Leaves on the trees blowing gently in the wind, or scarily, the waves pounding through high surf, or lightly on a warm summer’s day; that opportunity to sit or swim in the water on a white beach.   That comfort to shout, “The universal conscious do you hear me?  I am alive, guide me dear logos towards the path of rightnesses.”  Earned what has been kept, no longer to be absorbed into a life filled with cold damn winds and  that stubborn fog clouding  my vision with nothing but darkness."


#5
Andrew Patterson

Andrew Patterson

    Key Contributor

  • Validated Member
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:Toronto, ON
  • Canada

Zoom out to the furthest extent, select the layer where the KML is on, & if I'm correct you will see the KML way off the board shown as a dot. What this means is that your projection is incorrect & incompatible with your map view. Just keep in mind that KML can only be projected in Lat/Lon or in Arc terms the geographic projection.


Hey, I'm the guy who wrote the KML Reader for MAPublisher -- if you've got a problem file, I'd be happy to take a look at it :)

What version of MAPublisher are you running? We switched to using libkml in 8.2 and libkml handles badly formatted coordinates a lot better than the older KML reader. So if you're using 8.1 or earlier, it might just be a matter of cleaning up some bad coordinate formatting.
Andrew Patterson
Lead Software Architect
Avenza Systems Inc.

email: andrew@avenza.com
phone: 416.487.5116

#6
David Medeiros

David Medeiros

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,069 posts
  • Gender:Male
  • Location:Redwood City CA
  • Interests:Cartography, wood working, wooden boats, fishing, camping, overland travel, exploring.
  • United States

Zoom out to the furthest extent, select the layer where the KML is on, & if I'm correct you will see the KML way off the board shown as a dot. What this means is that your projection is incorrect & incompatible with your map view. Just keep in mind that KML can only be projected in Lat/Lon or in Arc terms the geographic projection.


Nope, nothing there. It's coming into an empty workspace with no Map View so it should place it on the board set to a Lat/Long projection.

GIS Reference and Instruction Specialist, Stanford Geospatial Center.

 

www.mapbliss.com

 


#7
David Medeiros

David Medeiros

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,069 posts
  • Gender:Male
  • Location:Redwood City CA
  • Interests:Cartography, wood working, wooden boats, fishing, camping, overland travel, exploring.
  • United States

Zoom out to the furthest extent, select the layer where the KML is on, & if I'm correct you will see the KML way off the board shown as a dot. What this means is that your projection is incorrect & incompatible with your map view. Just keep in mind that KML can only be projected in Lat/Lon or in Arc terms the geographic projection.


Hey, I'm the guy who wrote the KML Reader for MAPublisher -- if you've got a problem file, I'd be happy to take a look at it :)

What version of MAPublisher are you running? We switched to using libkml in 8.2 and libkml handles badly formatted coordinates a lot better than the older KML reader. So if you're using 8.1 or earlier, it might just be a matter of cleaning up some bad coordinate formatting.


Hey Andrew, thanks for chiming in. Actually, you can find the file attached here ;) http://www.avenza.co...php?topic=464.0

I'm on 8.2 so I should have the newest KML importer. Am I wrong in assuming that I do not need to set up a Map View prior to importing, that MAPub will import the KML as it does a .SHP file?

GIS Reference and Instruction Specialist, Stanford Geospatial Center.

 

www.mapbliss.com

 


#8
James Hines

James Hines

    James Anthony Hines

  • Validated Member
  • PipPipPipPipPipPip
  • 535 posts
  • Gender:Male
  • Location:Centreville, Nova Scotia
  • Interests:Cartography, Philosophy, Politics, Psychology, Economics, Occultism, Spiritualism
  • Canada

Zoom out to the furthest extent, select the layer where the KML is on, & if I'm correct you will see the KML way off the board shown as a dot. What this means is that your projection is incorrect & incompatible with your map view. Just keep in mind that KML can only be projected in Lat/Lon or in Arc terms the geographic projection.


Hey, I'm the guy who wrote the KML Reader for MAPublisher -- if you've got a problem file, I'd be happy to take a look at it :)

What version of MAPublisher are you running? We switched to using libkml in 8.2 and libkml handles badly formatted coordinates a lot better than the older KML reader. So if you're using 8.1 or earlier, it might just be a matter of cleaning up some bad coordinate formatting.

I've recently switched to 8.2, & nope I haven't tried KML since 8.1 since I had no use for it as of yet. Thanks for the update though.

"There is much beauty that we fail to see through our own eyes teeming with life forms that give us that perception of our reality.  Leaves on the trees blowing gently in the wind, or scarily, the waves pounding through high surf, or lightly on a warm summer’s day; that opportunity to sit or swim in the water on a white beach.   That comfort to shout, “The universal conscious do you hear me?  I am alive, guide me dear logos towards the path of rightnesses.”  Earned what has been kept, no longer to be absorbed into a life filled with cold damn winds and  that stubborn fog clouding  my vision with nothing but darkness."


#9
James Hines

James Hines

    James Anthony Hines

  • Validated Member
  • PipPipPipPipPipPip
  • 535 posts
  • Gender:Male
  • Location:Centreville, Nova Scotia
  • Interests:Cartography, Philosophy, Politics, Psychology, Economics, Occultism, Spiritualism
  • Canada

Zoom out to the furthest extent, select the layer where the KML is on, & if I'm correct you will see the KML way off the board shown as a dot. What this means is that your projection is incorrect & incompatible with your map view. Just keep in mind that KML can only be projected in Lat/Lon or in Arc terms the geographic projection.


Nope, nothing there. It's coming into an empty workspace with no Map View so it should place it on the board set to a Lat/Long projection.

Are you allowed to take that extra step and put into a GIS?

"There is much beauty that we fail to see through our own eyes teeming with life forms that give us that perception of our reality.  Leaves on the trees blowing gently in the wind, or scarily, the waves pounding through high surf, or lightly on a warm summer’s day; that opportunity to sit or swim in the water on a white beach.   That comfort to shout, “The universal conscious do you hear me?  I am alive, guide me dear logos towards the path of rightnesses.”  Earned what has been kept, no longer to be absorbed into a life filled with cold damn winds and  that stubborn fog clouding  my vision with nothing but darkness."


#10
Andrew Patterson

Andrew Patterson

    Key Contributor

  • Validated Member
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:Toronto, ON
  • Canada

Hey Andrew, thanks for chiming in. Actually, you can find the file attached here ;) http://www.avenza.co...php?topic=464.0

I'm on 8.2 so I should have the newest KML importer. Am I wrong in assuming that I do not need to set up a Map View prior to importing, that MAPub will import the KML as it does a .SHP file?


No, it's just like any other importer, it should create the MAP View for you.

Its not the problem I thought it was, since you're using a network link! I wasn't sure if anyone was using that ability of the reader so I'm at least happy to see someone is trying to leverage it ;)

I had a big response typed out here to explain why it wasn't working and then I realized what the problem is -- there's a bug where its not reading the html entities correctly. Unfortunately, if you convert them (in this case, & to &) they'll just cause the libkml portion to complain they're not formatted correctly (which is true).

The only good news is that this is already fixed internally. There was a dependency problem with the method I was using to fetch the network'd KML so they switched that part to a different library, and from what I see that one handles the html entities properly. The bad news is I don't see how to fix this with the current build. We only ever tested it with direct links to external KML files since we didn't have a server process anywhere serving up KML files -- so we never tried it with parameters. I'm definitely going to hang on to this file and add it to our test suite!

I know that's probably not super comforting, but for now I guess the MAPublisher KML reader only supports links without html entities in them. Unfortunately, this means pretty much any server-generated KML :( MAPublisher 8.3 should have a fix for this, but I don't see a workaround in the interim (other than to download the linked KML file and import it directly).

I'm sorry David, I wish I had better news there.
Andrew Patterson
Lead Software Architect
Avenza Systems Inc.

email: andrew@avenza.com
phone: 416.487.5116

#11
David Medeiros

David Medeiros

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,069 posts
  • Gender:Male
  • Location:Redwood City CA
  • Interests:Cartography, wood working, wooden boats, fishing, camping, overland travel, exploring.
  • United States

Andrew,

I’m not sure I was using the network link function. I saved the route from the Google Maps site as a KML to my desktop to open in Google Earth and MAPub. It opens in GE but not MP (obviously). I assume that’s what you meant by download and import directly?

GIS Reference and Instruction Specialist, Stanford Geospatial Center.

 

www.mapbliss.com

 


#12
Andrew Patterson

Andrew Patterson

    Key Contributor

  • Validated Member
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:Toronto, ON
  • Canada

I’m not sure I was using the network link function. I saved the route from the Google Maps site as a KML to my desktop to open in Google Earth and MAPub. It opens in GE but not MP (obviously). I assume that’s what you meant by download and import directly?


Not quite. What I meant was if you open up the KML you posted on the Avenza forum you'll see that its just one tag that boils down to a URL:
<Link>
<href>http://maps.google.c...tput=kml</href>
</Link>

If you take the contents of the <href> tag and replace '&amp;' with '&', you'll get:

http://maps.google.c...i...&output=kml

If you cut & paste that second line into your browser's address bar, it should pop up asking you where you want to save a KML file -- one that should import into MAPublisher just fine! At least, it does when I try it :)

Ideally, you shouldn't need to do this, it should follow the network link. I don't think there are actually many KML readers besides Google Earth that actually support that, but I took a stab at it with ours. Obviously, I only partially succeeded, but I'll make sure these html entities are better handled in 8.3
Andrew Patterson
Lead Software Architect
Avenza Systems Inc.

email: andrew@avenza.com
phone: 416.487.5116

#13
Andrew Patterson

Andrew Patterson

    Key Contributor

  • Validated Member
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:Toronto, ON
  • Canada

I forgot to mention: the main reason I implemented the NetworkLink tag in our reader is I figured there might be some users out there who had access to server-produced information in KML format. If you were overlaying something like traffic data on a map every week, and it came in KML form from some address on the web, you could theoretically build yourself a simple KML file that had a NetworkLink pointing at the server script. Then you'd just need to open the KML file on your desktop (or wherever you put it) and it would always be whatever that remote script was pumping out at that moment.

As I said originally, I didn't think many people had thought to use it, but I believe that's the intention behind NetworkLink's presence in the KML spec -- that's how they do things like give up-to-date weather overlays & such in Google Earth (or if they don't, they could). Obviously, I'll need to fix it a little before its really useful that way, but that was the intention at any rate. You could even have a KML file that pulled from several sources as one import, but you'd have to build the file yourself since there's really no way to export a NetworkLink file from MAPublisher. Fortunately, if you look at the file you posted, its not a particularly complicated thing to do :)
Andrew Patterson
Lead Software Architect
Avenza Systems Inc.

email: andrew@avenza.com
phone: 416.487.5116

#14
David Medeiros

David Medeiros

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,069 posts
  • Gender:Male
  • Location:Redwood City CA
  • Interests:Cartography, wood working, wooden boats, fishing, camping, overland travel, exploring.
  • United States

Thanks Andrew, I downoaded the file and will try it out when I get home. Kimi posted the workaround on the Avenza forum: http://www.avenza.co...w;topicseen#new

I understand the network link now, I didn't realize that KML files could be used to point to an online data source, thats pretty cool. Looking forward to the MAPub fix.

Thanks again!

GIS Reference and Instruction Specialist, Stanford Geospatial Center.

 

www.mapbliss.com

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->