0

I am attempting to create and then run a kml script which shows routes from two points in Python.

I managed to create a route with a wrapper in Python called pygmaps. I wanted to know if it is possible to create a KML script with co-ordinates (latitude and longtitude) in a Python script and then somehow run it as soon as the Python script is executed?

I had success with Pygmaps as it visualises points on a map but I was asked to do this on KML as draws lines from point to point rather than along the route.

This is the pygmap link - Points appear on map google python code

I found a website where the user has uploaded a KML script and run it on Googlemaps.com http://www.ninemoreminutes.com/2009/12/google-maps-with-python-and-kml/

and the link to how its displayed is here : http://maps.google.com/?q=http://www.ninemoreminutes.com/bojomap.kml

I dont know if it is possible. From everythin that I have found out, it seems as though a KML file needs to be created and then either uploaded or run for the map to be shown.

Thanks

1
  • KML is just XML. Writing an XML is trivial. "somehow run it"? Run it though what? Google Earth? Commented Feb 22, 2012 at 17:56

1 Answer 1

0

It's unclear how you want to run the KML script, whether you want to use Google Earth, Google Maps, the Google Earth API, or the Google Maps API.

What you probably need for any of that is a KML NetworkLink file, which is a KML file that points to your script and then loads it in as KML. To load that into Google Earth, you would just need to load the NetworkLink file into any Google Earth instance you're running. As long as your server is accessible by the person using your file, it would work.

To use it in Google Maps or the Google Maps API, your server has to be accessible on the public internet, as does your NetworkLink file. To use the Google Maps API, you would load your NetworkLink KML file onto a server and then use a KMLLayer to load it into your Maps API application.

Sign up to request clarification or add additional context in comments.

1 Comment

I apologise I wasn't very clear as to how I want to run the script. I would like to show this in a new webpage,if possible.I am trying to create a road trip planner, I have access to co-ordinates which are needed and all that is left is to visualise these points. Different users will be input different destinations and once these co-ordinates are obtained,they need to be displayed.Is it possible to show these routes in a googlemaps webpage the way pygmaps does? That way,when the python script is executed,a users information is submitted and the routes are formulated and displayed in a webpage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.