Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var fromProjection = new OpenLayers.Projection("EPSG:4326");
- var toProjection = new OpenLayers.Projection("EPSG:3857");
- var map = new OpenLayers.Map("map");
- var vectorFormat = new OpenLayers.Format.GeoJSON();
- var vectorProtocol = new OpenLayers.Protocol.HTTP({
- url: "http://localhost:9000/getcoords",
- format: vectorFormat,
- params: {
- "city":"PARIS",
- "city_code":3
- }
- });
- var refresh = new OpenLayers.Strategy.Refresh({ force: true, active: true });
- var vectorStrategies = [new OpenLayers.Strategy.Fixed(), refresh];
- var osm = new OpenLayers.Layer.OSM();
- var vectors = new OpenLayers.Layer.Vector({
- protocol: vectorProtocol,
- strategies: vectorStrategies,
- format: vectorFormat
- });
- map.addLayers([osm, vectors]);
- map.setCenter(new OpenLayers.LonLat(2.3983034, 47.078038).transform(fromProjection, toProjection), 6);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement