KML Database- Drawing lines with street routes (or somehow convert routes to coordinates)

269 views
Skip to first unread message

J.Miller

unread,
Sep 19, 2011, 8:28:50 PM9/19/11
to Google Maps JavaScript API v3
Hi,
I'm very new so if my questions seem dumb, sorry.

This is the exact sort of format I need...

http://www.google.com/url?sa=D&q=http://code.google.com/apis/maps/documentation/javascript/examples/layer-kml.html&usg=AFQjCNE99vPL8MWYtoiiU3N2dHoTxQoBFg

I've downloaded the corresponding KML database and it uses a ton of
coordinates to draw out the lines. Is it possible to do the same with
point A(street address) to point B(street address)? If not, is it
possible to convert street address routes to coordinates like in the
KML file?

Short example from the KML database:
<Placemark>
<name>Yellow Line</name>
<styleUrl>#yellowLine</styleUrl>
<LineString>
<altitudeMode>relative</altitudeMode>
<coordinates>
-87.75250,42.04049,0
-87.74726629257202,42.02620267868042,0
-87.74621486663818,42.0246148109436,0
-87.7447772026062,42.02352046966553,0
-87.74299621582031,42.02279090881348,0
-87.74123668670654,42.02244758605957,0
-87.73864030838013,42.02244758605957,0
-87.7224612236023,42.02253341674805,0
-87.71857738494873,42.02274799346924,0
-87.70164728164673,42.02274799346924,0
-87.6994800567627,42.022597789764404,0
-87.69748449325562,42.022318840026855,0
-87.6934289932251,42.022361755371094,0
-87.68842935562134,42.02191114425659,0
-87.67958879470825,42.02188968658447,0
-87.67855882644653,42.021803855895996,0
-87.67757177352905,42.021610736846924,0
-87.67619848251343,42.021117210388184,0
-87.6747179031372,42.02038764953613,0
-87.67283499240875,42.019110918045044,0
</coordinates>
</LineString>
</Placemark>

I need to be able to add a bunch of route lines in quick fashion so I
need a practical way.
Any help is greatly appreciated.

Thanks

MymsMan

unread,
Sep 20, 2011, 5:40:27 AM9/20/11
to google-map...@googlegroups.com
You can draw multiple routes on a map by using  multiple calls to the directions services  and multiple instances of the directions renderer.

The results from the directions service contain all the coordinates needed to draw the route so you could save them in KML format for subsequent reuse.

Trevor Seaman

unread,
Sep 20, 2011, 5:43:51 AM9/20/11
to google-map...@googlegroups.com
Us my maps to draw your lines, after you save your map down load the kml file.


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Andrew Leach

unread,
Sep 20, 2011, 5:48:01 AM9/20/11
to google-map...@googlegroups.com
On 20 September 2011 01:28, J.Miller <jmil...@kent.edu> wrote:
>
> I've downloaded the corresponding KML database and it uses a ton of
> coordinates to draw out the lines. Is it possible to do the same with
> point A(street address) to point B(street address)? If not, is it
> possible to convert street address routes to coordinates like in the
> KML file?

Drawing streets will need many coordinates (to follow a curve, for example).

Bear in mind that it may be easier to mark out the boundaries of an
area, as pointed out in your previous thread:
http://groups.google.com/group/google-maps-api/browse_thread/thread/b889df704b11d91f

J.Miller

unread,
Sep 20, 2011, 11:35:14 AM9/20/11
to Google Maps JavaScript API v3
--This sounds great! Do you happen to have a guide or something you
can point me towards?

"Us my maps to draw your lines, after you save your map down load the
kml
file. "

---Where are your maps?

"Drawing streets will need many coordinates (to follow a curve, for
example).

Bear in mind that it may be easier to mark out the boundaries of an
area, as pointed out in your previous thread:
http://groups.google.com/group/google-maps-api/browse_thread/thread/b.."

---(copied from other)The people I'm working with want lines, but if I
cant figure it out then I guess I'll have to deal with it. Is there an
easy way to graph out regions like the trash one, or will I have to
manually do it still?

Thanks..


On Sep 20, 5:48 am, Andrew Leach <andrew.leac...@gmail.com> wrote:
> area, as pointed out in your previous thread:http://groups.google.com/group/google-maps-api/browse_thread/thread/b...

MymsMan

unread,
Sep 20, 2011, 1:41:22 PM9/20/11
to google-map...@googlegroups.com
You could look at http://calonmap.clanteam.com/CalOnMapPublic.html  for an example that uses multiple sets of directions. (change routeMode in options to Star mode)
The code is large and complex but only a small part is related to using multiple directions - I don't have a simplified example.

The other approach proposed by Trevor is to use the standard web interface maps.google.com to generate a set of directions, or a line using the line drawing tool, these can then be saved to My Places using the 'save to My Maps '  link.   You can then download the map information as a KML file which can be edited as necessary to give each route a different colour etc and used in your application.

Which approach is most appropriate will depend on whether you have a limited number of relatively static routes or whether your routes change frequently and need to be calculated dynamically.

xelawho

unread,
Sep 20, 2011, 2:06:17 PM9/20/11
to Google Maps JavaScript API v3
> is it possible to convert street address routes to coordinates like in the
> KML file?

rather than re-invent the wheel, you could always use Larry's
directions-to-xml example:
http://www.geocodezip.com/v3_GoogleEx_directions-draggable2Xml.html

and either tweak the code to produce kml output or convert the output
to kml format using good ol' find n replace

J.Miller

unread,
Sep 20, 2011, 9:59:07 PM9/20/11
to Google Maps JavaScript API v3
Thanks so much for the help everyone. That link looks really helpful
xela. I'll try to figure out enough javascript to tweak it to generate
kml (or somehow query a databse for this info).
Reply all
Reply to author
Forward
0 new messages