Jump to content

 
Photo

Converting Shapefiles to Kml

- - - - -

  • Please log in to reply
10 replies to this topic

#1
snowgage

snowgage

    Key Contributor

  • Validated Member
  • PipPipPip
  • 56 posts
  • Gender:Male
  • Location:Bozeman, MT
  • United States

I am converting some shapefiles that will be incorporated into a GoogleMaps application using the Flash API. When I export from ArcGis the XML formatting of the Kml is a real disaster. The resulting Kml can still be read into GoogleEarth Desktop but not into an app using the flash api.

If I convert the shapefile using Google Earth Pro the resulting Kml is nicely formated and works great. I am using PRO on a trial basis so this is not a permanent fix.

Does anyone have any better ideas for prepping shapefiles for use in a AS3 powered Google Maps application? I'll need the overlays to be interactive vectors so using an image overlay might not be the best solution.

Below is an example of what is exported from ArcGis using the LayerToKml tool
http://gagecartograp...t/hikestock.kml

And using Google Earth Pro.. Much prettier XML formatting
http://gagecartograp.../hikestock2.kml

thanks in advance...

-josh

#2
dsl

dsl

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 225 posts
  • Gender:Male
  • Location:Denver
  • United States

As far as I can tell both use proper KML syntax that can be parsed by an XML reader. You just need to know the elements and attributes to get to them...It looks like the ArcGIS dumps the attribute table as a description, whereas the GE pro uses the schema tags. I don't know what you want to do with the attributes. See documentation: http://help.adobe.com/en_US/FlashPlatform/...MLDocument.html

You could try GDAL / FWTools open source tools to convert the shapefile over to a variety of formats easily parsed (GML, GeoJson, KML).

Another option is to load the shapefile directly into your flash application. Here are some examples:

http://www.cartogram...actionscript-3/
http://www.boxshaped...oogle-Maps.aspx
http://code.google.c...jkom-flashlibs/

Or switch to the javascript google maps api and use the KML layer as of version 3.

Hope that helps,
David

#3
snowgage

snowgage

    Key Contributor

  • Validated Member
  • PipPipPip
  • 56 posts
  • Gender:Male
  • Location:Bozeman, MT
  • United States

Thanks David,

Those are helpful suggestions. I initially tried loading my shp directly into GoogleMaps but was having some issues and
started working with KML.

I think I'll start experimenting with some of the other formats you list and see if they are a better fit.

cheers,

-josh


As far as I can tell both use proper KML syntax that can be parsed by an XML reader. You just need to know the elements and attributes to get to them...It looks like the ArcGIS dumps the attribute table as a description, whereas the GE pro uses the schema tags. I don't know what you want to do with the attributes. See documentation: <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/xml/XMLDocument.html" target="_blank">http://help.adobe.com/en_US/FlashPlatform/...MLDocument.html</a>

You could try GDAL / FWTools open source tools to convert the shapefile over to a variety of formats easily parsed (GML, GeoJson, KML).

Another option is to load the shapefile directly into your flash application. Here are some examples:

http://www.cartogram...actionscript-3/
http://www.boxshaped...oogle-Maps.aspx
http://code.google.c...jkom-flashlibs/

Or switch to the javascript google maps api and use the KML layer as of version 3.

Hope that helps,
David



#4
heath b

heath b

    Key Contributor

  • Validated Member
  • PipPipPip
  • 71 posts
  • Gender:Male
  • Location:Portland, OR
  • Interests:the great outdoors, bouldering, martinis, unusual graphical representation
  • United States

Have you tried using Kevin Martin's Export to KML script for ArcGIS? It has a bit more functionality than the ESRI version and may get around your problem.
Heath

#5
wick

wick

    Contributor

  • Validated Member
  • PipPip
  • 27 posts
  • Gender:Male
  • United States

This might help...
1) Export the KML from ArcGIS
2) Open the KML in GE
3) Save the KML as a new KML from GE (don't need pro)
Jesse Wickizer
Maps.com

#6
Matthew Hampton

Matthew Hampton

    Hall of Fame

  • Moderator
  • PipPipPipPipPipPipPip
  • 1,309 posts
  • Gender:Male
  • Location:Portland, Oregon
  • Interests:Playing in the mountains and rivers.
  • United States

In addition to the other suggestions, I have also had good luck using the cloud-based software from Zonums.com. Although I specifically use their kml2shp service which was at one time, the only good solution for moving data the other direction.

co-cartographic creator of boringmaps.com


#7
Sab

Sab

    Key Contributor

  • Validated Member
  • PipPipPip
  • 51 posts
  • United Kingdom

Open the file in QGIS, right-click and save as...KML

#8
Andrew

Andrew

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 102 posts
  • Gender:Male
  • Location:Australia
  • Interests:Web development, and golf!
  • Australia

Open the file in QGIS, right-click and save as...KML


I agree with Sab.

QGIS is free and the best part is the exported KML is nicely formatted.

#9
snowgage

snowgage

    Key Contributor

  • Validated Member
  • PipPipPip
  • 56 posts
  • Gender:Male
  • Location:Bozeman, MT
  • United States

Open the file in QGIS, right-click and save as...KML


I agree with Sab.

QGIS is free and the best part is the exported KML is nicely formatted.



I tried a few of the approaches and found QGIS to work best. I also like the formatting as it's easily parsed into my Flash document. Thanks for all the great suggestions!

#10
Kalai Selvan

Kalai Selvan

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 159 posts
  • Gender:Male
  • Location:India
  • Interests:Map Making &amp; Map making
  • India

snowgage,

The best of all is global mapper, its cheaper and does more than you want (I mean all sort of conversion from 1 format to another)

Thanks
Kalai Selvan



I am converting some shapefiles that will be incorporated into a GoogleMaps application using the Flash API. When I export from ArcGis the XML formatting of the Kml is a real disaster. The resulting Kml can still be read into GoogleEarth Desktop but not into an app using the flash api.

If I convert the shapefile using Google Earth Pro the resulting Kml is nicely formated and works great. I am using PRO on a trial basis so this is not a permanent fix.

Does anyone have any better ideas for prepping shapefiles for use in a AS3 powered Google Maps application? I'll need the overlays to be interactive vectors so using an image overlay might not be the best solution.

Below is an example of what is exported from ArcGis using the LayerToKml tool
http://gagecartograp...t/hikestock.kml

And using Google Earth Pro.. Much prettier XML formatting
http://gagecartograp.../hikestock2.kml

thanks in advance...

-josh


Thanks and Regards
Kalai Selvan


#11
Sab

Sab

    Key Contributor

  • Validated Member
  • PipPipPip
  • 51 posts
  • United Kingdom

snowgage,

The best of all is global mapper, its cheaper and does more than you want (I mean all sort of conversion from 1 format to another)

Thanks
Kalai Selvan


You mean it's cheaper than QGIS which is FREE. Does it support more format than this and this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->