proj4js

trying to use EPSG:3857 in Leaflet

帅比萌擦擦* 提交于 2020-03-05 03:24:46
问题 I am trying to make leaflet use EPSG:3857 as an input coordinate system. I use porj4leaflet to achieve this. I have defined my map instance like this: var map = L.map('map', { center: [8378860.13, 1481133.311008498], zoom: 7, crs: new L.Proj.CRS( 'EPSG:3857', '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', { resolutions: [ 8192, 4096, 2048, 1024, 512, 256, 128 ], origin: [0, 0] } ) }); When I try to run this, i get

Leaflet map with WMS and custom projection

时光毁灭记忆、已成空白 提交于 2020-01-14 07:53:28
问题 I have implemented a map using Leaflet and tiles from a WMS-service. They offer a list of projections, where of one is usable in standard Leaflet EPSG:4326. However, the map looks a bit distorted, and I recon one of the other projections would be better. The supplier of the maps uses EPSG:32624, but I cannot seem to get that projection right. This is the complete list: EPSG:32624, EPSG:32619, EPSG:32620, EPSG:32621, EPSG:32622, EPSG:32623, EPSG:32624, EPSG:32625, EPSG:32626, EPSG:32627, EPSG

OpenLayers Projections

冷暖自知 提交于 2019-12-23 15:46:13
问题 I can succesfully do: point.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326")); To a point that is in the google format (in meters), but when I want to do the reverse: point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")); to a point that is in 4326 (regular lat/lon format), I am having some issues. Any negative value seems to become NaN (not a number) when I do the transformation. Is there something about

How to convert Vector Layer coordinates into Map Latitude and Longitude in Openlayers

懵懂的女人 提交于 2019-12-17 23:12:41
问题 I'm pretty confused. I have a point: x= -12669114.702301 y= 5561132.6760608 That I got from drawing a square on a vector layer with the DrawFeature controller. The numbers seem...erm...awfull large, but they seem to work, because if I later draw a square with all the same points, it's in the same position, so I figure they have to be right. The problem is when I try to convert this point to latitude and longitude. I'm using: map.getLonLatFromPixel(pointToPixel(points[0])); Where points[0] is

Converting latitude/longitude to Alberta 10 TM Projection

可紊 提交于 2019-12-12 07:16:27
问题 I need to convert latitude/longitude coordinates into Easting/Northing coordinates in the Alberta 10 TM Projection. The 10 TM projection is similar to UTM, but it is a custom projection for the province of Alberta, Canada. I think (with some effort) I could code it myself but would rather not reinvent the wheel if it's been done already. 回答1: Grab PROJ.4 Cartographic Projections library - open source library. Suggested parameters for 10TM: +proj=tmerc +lon_0=-115 +k_0=0.9992 +x_0=500000

How to use OpenLayers 3 with Proj4js

与世无争的帅哥 提交于 2019-12-11 02:20:29
问题 I'm working on a map viewer project and used openlayers 2 before this. Now I have to use OpenLayers 3 and map viewer app should support many different projections because I have wms and wfs layers from different sources and projections. I've found examples that use openlayers2 and proj4js. But I couldn't find explicit example for using ol3 and proj4js. What is your suggestion? 回答1: It seems that sometimes, like when using OpenLayers 3 and proj4 in Angular 2 using webpack, one needs to

lat/lon conversion to x/y-coordinates

一世执手 提交于 2019-12-08 07:44:32
问题 I have a openstreetmap image. left upper corner is lat: 80 lon: -169 and right lower corner is lat:-56 lon: 190 The image has the width: 2618 and the height: 1513 How do I convert given lat/lon-coordinates to the pictures x/y-coordinates? I tried it by myself, but couldn't figure out how to convert the coordinates. I hope someone can answer my question. 回答1: The question, as asked, is almost nonsensical. The area requested covers almost the entire globe, from 80N 169W to 56S 190E. That leaves

lat/lon conversion to x/y-coordinates

纵饮孤独 提交于 2019-12-06 15:05:01
I have a openstreetmap image. left upper corner is lat: 80 lon: -169 and right lower corner is lat:-56 lon: 190 The image has the width: 2618 and the height: 1513 How do I convert given lat/lon-coordinates to the pictures x/y-coordinates? I tried it by myself, but couldn't figure out how to convert the coordinates. I hope someone can answer my question. The question, as asked, is almost nonsensical. The area requested covers almost the entire globe, from 80N 169W to 56S 190E. That leaves out the band pole to pole from 170W to 169W, a disk around the north pole north of 80N, and a larger disk

Change Projection in OpenLayers Map

落花浮王杯 提交于 2019-12-06 07:14:02
问题 I want to set "EPSG:4326" as the projection of an OpenLayers map, but when I try it, I always get "EPSG:900913". function init() { var options = { projection: new OpenLayers.Projection("EPSG:4326") // ignored }; map = new OpenLayers.Map('map', options); var layer = new OpenLayers.Layer.OSM.Osmarender("Osmarender"); map.addLayer(layer); ... alert(map.getProjection()); // returns "EPSG:900913" ... } The base map is open street map. How can I set the Projection to EPSG:4326? 回答1: It is

how to call parameterized javascript function in the WebKit?

南笙酒味 提交于 2019-12-05 21:51:30
I am trying to pass 2 parameters to a javascript function.This code webview.loadUrl("javascript: function_to_call();"); works fine without parameters but i couldn't use it with parameters. This is javascript junction : function changeLocation(_lon , _lat){ var zoom=16; var lonLat = new OpenLayers.LonLat( _lon , _lat ).transform( new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); map.setCenter (lonLat, zoom); } And this is how i call it from java : webView.loadUrl("javascript:changeLocation( -0.1279688 ,51.5077286 );") ; Edit: I couldn't find the problem and i changed my