Saving google map in some manners

840 views
Skip to first unread message

sangi1981

unread,
May 31, 2010, 6:35:10 AM5/31/10
to Google Maps JavaScript API v3
Hi,
I'm new and I just started programming with AJAX and Google API.
I'm developing on an open source project that uses Google maps.
I was asked to save the map displayed on the PC.
I'm trying to follow the path of static maps, but do not understand
how I could do and if this is possible.
If someone can give me some help?
Thank you very much

en4ce

unread,
May 31, 2010, 7:10:28 AM5/31/10
to Google Maps JavaScript API v3
Hi sangi

step 1 store the cords (latlng) in a database
step 2. render a kml file out of the stored cords

or render the file directy without store the data

in both cases you´ll need that kml file

take a look on the kml reference

p.s. dont go with staticmaps :-P

maybe try something easy like this 1st:
http://code.google.com/intl/de-DE/apis/maps/documentation/javascript/introduction.html

sangi1981

unread,
May 31, 2010, 3:48:54 PM5/31/10
to Google Maps JavaScript API v3
Thanks for the reply.
I look at the tutorial.
What is a kml file?

The application I'm working already uses Google Map API.
I was asked to extend this application, adding a button for saving as
an image map currently displayed in the browser.

So I wondered if it were possible, and how it is.

Thanks again for any replies.



On 31 Mag, 13:10, en4ce <djen...@googlemail.com> wrote:
> Hi sangi
>
> step 1 store the cords (latlng) in a database
> step 2. render a kml file out of the stored cords
>
> or render the file directy without store the data
>
> in both cases you´ll need that kml file
>
> take a look on the kml reference
>
> p.s. dont go with staticmaps :-P
>
> maybe try something easy like this 1st:http://code.google.com/intl/de-DE/apis/maps/documentation/javascript/...

sangi1981

unread,
May 31, 2010, 3:50:47 PM5/31/10
to Google Maps JavaScript API v3
Thanks for the reply.
I look at the tutorial.
What is a kml file?

The application I'm working already uses Google Map API.
I was asked to extend this application, adding a button for saving as
an image map currently displayed in the browser.

So I wondered if it were possible, and how it is.

Thanks again for any replies.



On 31 Mag, 13:10, en4ce <djen...@googlemail.com> wrote:
> Hi sangi
>
> step 1 store the cords (latlng) in a database
> step 2. render a kml file out of the stored cords
>
> or render the file directy without store the data
>
> in both cases you´ll need that kml file
>
> take a look on the kml reference
>
> p.s. dont go with staticmaps :-P
>
> maybe try something easy like this 1st:http://code.google.com/intl/de-DE/apis/maps/documentation/javascript/...

en4ce

unread,
Jun 1, 2010, 3:14:31 AM6/1/10
to Google Maps JavaScript API v3
thats not a good way to store data, not only the size of the data
(picture) as long as the usability would be not very good

a kml file is basicly a very simple xml file in which the cordinates
and some extra data will be stored, the maps api understand that file
format an display the data (whatever you did say there, f.e. polylines
or markers or something)

you can do something like this:

function saveme(){

for (var i = 0; i < markers.length; i++) {
cords += markers[i].getPosition());
}
document.getElementById("savefield").value = cords;
}

push that cords variable into a hiddenfield in your page and submit
that page, get the hidden field and save it into a database...(or
parse the kml file right along and save it)

now just read the database and create a kml file (i do it with php and
fwrite) and give that kml to the maps api, once you are in there its
easy

give the api the kml file can look something like that

function initialize() {

var myLatlng = new google.maps.LatLng(LatLgn);
var myOptions = {
zoom: <?php echo($zoomlvl)?>,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}

var map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);

var georssLayer = new google.maps.KmlLayer('http://yourdomain.com/
yourkml.kml');
georssLayer.setMap(map);
}

grez
Message has been deleted

Miguel Angel Vilela

unread,
Jun 1, 2010, 3:36:24 AM6/1/10
to google-map...@googlegroups.com

But if what you really need is a static image of the map, then the Static Maps API can give you that.
However, the Static Maps API has no support for some of the things you may want to save, i.e. InfoWindow.


If you are looking at something that would give you, in a static image, exactly the same thing your map shows at any given time, I'm afraid there is no such a thing available in the Maps APIs.

--
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.

Daejeon

unread,
Jul 22, 2011, 5:06:28 AM7/22/11
to google-map...@googlegroups.com
How to retrieve the data? If I would like to save the cords into xml file instead of KML? Thanks

geoco...@gmail.com

unread,
Jul 22, 2011, 6:25:35 AM7/22/11
to Google Maps JavaScript API v3
On Jul 22, 5:06 am, Daejeon <siaw.man3...@gmail.com> wrote:
> How to retrieve the data? If I would like to save the cords into xml file
> instead of KML?

KML is xml, just a particular form of xml.

You need to be more specific about what you mean by "xml" if you don't
want to use KML.
KML Reference:
http://code.google.com/apis/kml/documentation/kmlreference.html

-- Larry

> Thanks

Florian Behr

unread,
Jul 22, 2011, 6:24:04 AM7/22/11
to google-map...@googlegroups.com
I don't really know what you mean, but it seems what you want to do comes down to just generic javascript and maybe some php. Not really Gmaps specific.

So if you would like to elaborate...

2011/7/22 Daejeon <siaw.m...@gmail.com>
How to retrieve the data? If I would like to save the cords into xml file instead of KML? Thanks

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
Reply all
Reply to author
Forward
0 new messages