KML import to MAPublisher?
#1
Posted 08 February 2010 - 11:06 PM
Thanks,
Dave
#2
Posted 08 February 2010 - 11:43 PM
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?
Red Geographics
Email: hans@redgeographics.com / Twitter: @redgeographics
#3
Posted 08 February 2010 - 11:51 PM
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.
#4
Posted 09 February 2010 - 07:29 AM
#5
Posted 09 February 2010 - 09:56 AM
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.
Lead Software Architect
Avenza Systems Inc.
email: andrew@avenza.com
phone: 416.487.5116
#6
Posted 09 February 2010 - 10:30 AM
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.
#7
Posted 09 February 2010 - 10:35 AM
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
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?
#8
Posted 09 February 2010 - 11:25 AM
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.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.
#9
Posted 09 February 2010 - 11:29 AM
Are you allowed to take that extra step and put into a GIS?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.
#10
Posted 09 February 2010 - 11:39 AM
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
I'm sorry David, I wish I had better news there.
Lead Software Architect
Avenza Systems Inc.
email: andrew@avenza.com
phone: 416.487.5116
#11
Posted 09 February 2010 - 01:01 PM
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?
#12
Posted 09 February 2010 - 01:44 PM
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 '&' 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
Lead Software Architect
Avenza Systems Inc.
email: andrew@avenza.com
phone: 416.487.5116
#13
Posted 09 February 2010 - 01:50 PM
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
Lead Software Architect
Avenza Systems Inc.
email: andrew@avenza.com
phone: 416.487.5116
#14
Posted 09 February 2010 - 02:32 PM
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!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users


Sign In
Create Account

United States
Back to top
Netherlands
Canada









