Jesus Loves GRASS

Technical blog about GRASS/GIS,open source geoinformatics and MAPSERVER.

Monday, June 04, 2007

Mapserver Versus Google Earth

Thinking of using google earth as a WMS layer in your mapserver project ??! Then think again !!!

Gregor Mosheh
Reply-To: Gregor Mosheh
Date: Thu, 1 Mar 2007 10:17:58 -0700
Content-Type: text/plain

There's no way to use Google Maps in Mapserver, due to Google's terms of
use. Some folks wrote a WMS gateway to Google Maps, for example, and got a
cease-and-desist for it.

There are other options, though, if you're willing/able to serve up your
Mapserver output via WMS. A) You could use Mapserver's WMS output in a
Google Map, because Google doesn't have a problem with that. B) Look for a
framework that supports both WMS and Google Maps and use that to import
both your WMS output and Google's basemap; I know that OpenLayers had
Google Maps support on their drawing board, but I don't know the status of
it.


Source: Mapserver Mailing List

Labels: , ,

Friday, May 25, 2007

google maps

I had to make a google map with the locations of hotel for the participants of the AEMP2007 congress. The API of google maps is very simple:
1) Creation of the map including center point and zoom used
2) Include controls
3) Creation of the Icons to be used
4) Adding a point to the map and making a marker (clicking the point it will display HTML)
5) Div section with the map on the webpage

There is a nice webpage with google maps icons:
http://www.econym.demon.co.uk/googlemaps/geicons.htm

1) Creation of the map:
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.03339,-7.95112), 13);
map.setMapType(G_HYBRID_TYPE);

2) Include controls
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl(true));

3) Creation of Hotel icon

var iconHotel = new GIcon();
iconHotel.image = "http://maps.google.com/mapfiles/kml/pal2/icon20.png";
iconHotel.shadow = "http://maps.google.com/mapfiles/kml/pal2/icon20s.png";
iconHotel.iconSize = new GSize(32, 32);
iconHotel.shadowSize = new GSize(37, 34);
iconHotel.iconAnchor = new GPoint(9, 34);
iconHotel.infoWindowAnchor = new GPoint(9, 2);
iconHotel.infoShadowAnchor = new GPoint(18, 25);

4) Adding Point and marker
var pointIbis = new GLatLng(37.03339,-7.95112);
var markerIbis=new GMarker(pointIbis,iconHotel)
map.addOverlay(markerIbis);
GEvent.addListener(markerIbis, "click", function() {
markerIbis.openInfoWindowHtml("<b>Hotel Ibis</b>");
}); //don't forget this

and closing the load function and if statement:
}
}

- The function load() is called inside the body tag with the onload event
<body onload="load()">

- The DIV in the page couldn't be simpler
<div id="map" style="width: 600px; height: 400px"></div>

Labels: , ,