[OpenLayers-Users] KML reprojection?
Jeremy Husmann
Jeremy.Husmann at critchlow.co.nz
Tue Aug 18 15:44:46 EDT 2009
Chris,
All I can say is your that man.
Thanks heaps for the help guys.
Jeremy
-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com]
Sent: Wednesday, August 19, 2009 4:33 AM
To: Jeremy Husmann
Cc: Eric Lemoine; users at openlayers.org
Subject: Re: [OpenLayers-Users] KML reprojection?
On Tue, Aug 18, 2009 at 08:11:54PM +1200, Jeremy Husmann wrote:
> Hi Eric,
>
> Thanks for the reply. I have tried removing the TMS completely and this is when the projection issue comes into play.
Yes, this is a problem. The reprojection support is relaly about 'from the
data projection to the baselayer projection'; the baselayer being what
actually controls the projection of the map.
See:
http://crschmidt.net/mapping/choropleth-mercator.html
For an example of using a 'fake' baseLayer with a mercator projection, and
reprojecting to it in the standard ay, as another solution.
-- Chris
> I have two examples up on our server
>
> http://webmapping.critchlow.co.nz/working/googlelayer.html
>
> http://webmapping.critchlow.co.nz/working/nogoogle.html
>
>
> With the 'googlelayer' link I have a second base layer that is straight KML(labeled CoverageTEST) and the country comes up fine and looks how it should. - only problem is that I only want the KML as the base map and want to remove Google all together. - if I do this I get the 'nogoogle' layer.
>
> With the nogoogle layer - this is the aim. But the country is all a bit squashed - which points me to the projections.
>
> The other option I did try was setting the KML file as the map default baselayer but this didn't seem to help either.
>
> Any ideas?
>
> Jeremy
>
> P.S. sorry about the links they may be a little slow to load.
>
> -----Original Message-----
> From: Eric Lemoine [mailto:eric.lemoine at camptocamp.com]
> Sent: Tuesday, August 18, 2009 5:59 PM
> To: Jeremy Husmann
> Cc: users at openlayers.org
> Subject: Re: [OpenLayers-Users] KML reprojection?
>
> On Tuesday, August 18, 2009, Jeremy Husmann
> <Jeremy.Husmann at critchlow.co.nz> wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Hello everyone,
>
>
> Hi
>
>
> >
> >
> >
> > I am in the process of adding a KML as a baselayer (I was
> > quickly helped by Eric and Christopher by finding the constructor attribute
> > need for this.).
> >
> >
> >
> > Now I seem to have stuck another in relation to projections.
> >
> >
> >
> >
> > I have noticed that if I add the KML as the only base layer
> > it comes out a bit squashed, when if I don't change any projection
> > settings and just add a WMS layer as another base layer it seems to correct the
> > KML. - Unsure if anything is going on behind the scenes (with my KML
> > being reprojected?) or if im just missing something extremely obvious. -
> > Any help would be appreciated.
>
> What if you remove the TMS layer and have the vector layer as the only
> layer in the map?
>
>
> >
> >
> >
> > function
> > mapInit()
> >
> > {
> >
> > var
> > nzBounds = new OpenLayers.Bounds(165, -47, 180, -34.5).transform((new
> > OpenLayers.Projection("EPSG:4326")), (new
> > OpenLayers.Projection("EPSG:900913")));
> >
> >
> >
> >
> > var
> > options =
> >
> > {
> >
> > projection:
> > new OpenLayers.Projection("EPSG:900913"),
> >
> > displayProjection:
> > new OpenLayers.Projection("EPSG:4326"),
> >
> > units:
> > "m",
> >
> > maxResolution:
> > 16543.0339,
> >
> >
> >
> > maxExtent:
> > nzBounds,
> >
> > numZoomLevels:
> > 24,
> >
> > minZoomLevel:
> > 6,
> >
> > maxZoomLevel:18,
> >
> > controls:
> > [
> >
> >
> > new OpenLayers.Control.Navigation(),
> >
> >
> > new OpenLayers.Control.LayerSwitcher({'ascending':false}),
> >
> > new
> > OpenLayers.Control.PanZoomBar({zoomWorldIcon:true})
> >
> > ]
> >
> > };
> >
> >
> >
> >
> >
> > map = new OpenLayers.Map('map', options);
> >
> > map.addControl(new
> > OpenLayers.Control.LayerSwitcher());
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > var mapnik = new OpenLayers.Layer.TMS(
> >
> >
> > "OpenStreetMap (Mapnik)",
> >
> >
> > "http://tile.openstreetmap.org/",
> >
> >
> > {
> >
> >
> > type: 'png',
> >
> >
> > displayOutsideMaxExtent: true,
> >
> >
> > attribution: '<a
> > href="http://www.openstreetmap.org/">OpenStreetMap</a>'
> >
> >
> > }
> >
> >
> > );
> >
> >
> >
> >
> >
> > mapnik.setVisibility(false);
> >
> >
> >
> >
> > var
> > time = new Date();
> >
> > var
> > secs = time.getSeconds();
> >
> > postCodeKml
> > = new OpenLayers.Layer.GML("CoverageTEST",
> > "kml/coverage_1.kml?" + secs,
> >
> > {
> >
> >
> > format: OpenLayers.Format.KML,
> >
> > projection:map.displayProjection,
> >
> >
> >
> >
> >
> >
> >
> >
> > isBaseLayer:true,
> >
> >
> > formatOptions: {
> >
> >
> > extractStyles: true,
> >
> >
> > extractAttributes: true
> >
> >
> > }
> >
> >
> > }
> >
> >
> > );
> >
> >
> >
> >
> >
> > map.addLayers([mapnik]);
> >
> >
> >
> > postCodeKml.setVisibility(true);
> >
> > map.addLayer(postCodeKml);
> >
> > postCodeKml.setOpacity(0.25);
> >
> >
> >
> >
> > map.zoomToExtent(nzBounds);
> >
> >
> >
> > map.addControl(new OpenLayers.Control.MousePosition());
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list