[OpenLayers-Users] Google and UK grid vector overlay
Thomas Wood
grand.edgemaster at gmail.com
Wed Jan 14 09:58:24 EST 2009
I have an Ordnance Survey transformation class, for those that do not wish to
use proj4js.
It is available for download at
http://ge.pythonmoo.co.uk/maps/OpenLayers.Projection.OrdnanceSurvey.js
Please _do not_ hotlink to it.
goliah wrote:
>
> Hi Arnd.
> thank you for your response.
>
> No, i didn't include proj4js in my page.
> Now I've tried to include it in my html page (and include all the
> definitions), but it still does not work.
>
> Any other ideas?
> Thank you!
>
> Mauro
>
>
>
>
>
> 2009/1/13 Arnd Wippermann <arnd.wippermann at web.de>:
>> The code is correct.Have you included proj4js in your page?
>>
>> Otherwise
>> Transform depends on the proj4js library.
>> If proj4js is not available, then this is just an empty stub.
>>
>>
>> Arnd Wippermannn
>>
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
>> Im
>> Auftrag von Mauro Bianchi
>> Gesendet: Dienstag, 13. Januar 2009 11:51
>> An: users at openlayers.org
>> Betreff: [OpenLayers-Users] Google and UK grid vector overlay
>>
>> Dear all,
>> I'm pretty new to OL and I want to do the following
>>
>> 1) have a google layer as a base layer
>> 2) overlay a vector layer and add points programmatically. Points
>> coordinates are given in the UK national grid system (OSGB , which should
>> be
>> EPSG:27700)
>>
>> I could convert points coordinates externally, but I'd prefer to do it
>> directly into OpenLayers, if possibile.
>> I tried different methods but cannot get it working.
>> Any help would be really appreciated!
>>
>> Thank you
>> Mauro
>>
>>
>> My code is the following
>>
>>
>> var map;
>>
>> var options = {
>> projection: new OpenLayers.Projection("EPSG:900913"),
>> displayProjection: new OpenLayers.Projection("EPSG:4326"),
>> units: "m",
>> numZoomLevels: 18,
>> maxResolution: 156543.0339,
>> maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
>>
>> 20037508, 20037508.34)
>> };
>>
>> map = new OpenLayers.Map('map', options);
>>
>> //google maps layer, physical
>> var gphy = new OpenLayers.Layer.Google(
>> "Google Physical",
>> {type: G_PHYSICAL_MAP, numZoomLevels: 20,
>> 'sphericalMercator':true}
>> );
>>
>> map.addLayers([gphy]);
>>
>>
>> //a vector layer where i want to add points programmatically var
>> vectorLayer
>> = new OpenLayers.Layer.Vector("My Geometry");
>>
>> //this is a point that i want to add in UK grid coordinates var point =
>> new
>> OpenLayers.Geometry.Point(519000, 165222).transform( new
>> OpenLayers.Projection("EPSG:27700"), map.projection); var pointFeature =
>> new
>> OpenLayers.Feature.Vector(point);
>>
>> vectorLayer.addFeatures([pointFeature]);
>>
>> map.addLayer(vectorLayer);
>>
>> //controls and centering
>> map.addControl(new OpenLayers.Control.LayerSwitcher());
>> map.setCenter(new
>> OpenLayers.LonLat(-0.126343,51.539502).transform(map.displayProjection,
>> map.projection), 10);
>>
>>
>>
>>
>> --
>> Mauro Bianchi
>> bianchimro at gmail.com
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
>
>
> --
> Mauro Bianchi
> bianchimro at gmail.com
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://n2.nabble.com/Google-and-UK-grid-vector-overlay-tp2150605p2157235.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list