proj4js

How to transform coordinate from WGS84 to a coordinate in a projection with PROJ.4?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 18:54:23
问题 I have a GPS-coordinate in WGS84 that I would like to transform to a map-projection coordinate in SWEREF99 TM using PROJ.4 in Java or Proj4js in JavaScript. Its hard to find documentation for PROJ.4 and how to use it. If you have a good link, please post it as a comment. The PROJ.4 parameters for SWEREF99 TM is +proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs I have tried to use a PROJ.4 Java library for transforming Lat: 55° 00’ N, Long: 12° 45’ E and tried with this

Change Projection in OpenLayers Map

我们两清 提交于 2019-12-04 12:36:09
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? It is Osmarender that has a hardcoded 900913 projection, nothing to do about that. But have you considered taking things

How to transform a distance from degrees to metres?

瘦欲@ 提交于 2019-12-03 09:03:11
问题 I'm using OpenLayers with an ordinary mercator map and I'm trying to sample a bounding box by finding a grid of points in latlong. The bbox is expressed in latlon, e.g. 48.1388,-15.3616,55.2057,-3.9359 I can define a distance in degrees (e.g. x: 2.5, y: 2.4) and work out the points from there. But I'd like to express this distance in metres (e.g. 50000) in order to relate it to the user mindset (people understand metres, not degrees). How can I convert this distance? I know how to reproject a

Proj4Leaflet transform from 4326 to 3857 in Leaflet

被刻印的时光 ゝ 提交于 2019-12-02 14:05:00
问题 I am working on Leaflet from last week and this issue is killing me. The database returns coordinates to create a Leaflet marker (working with default Map.CRS EPSG3857), so I decide to transform the dataBase coordinates 4326 to 3857 with proj4js: var iarCoordinate = [-76.495207812, 3.429960207], obSource = new proj4.Proj('EPSG:4326'), obDest = new proj4.Proj('EPSG:3857'), obResult = new proj4.Point(iarCoordinate); proj4.transform(obSource, obDest, obResult); //obResult = [-8515407.581757482,

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

旧城冷巷雨未停 提交于 2019-11-28 20:27:43
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 a geometry Point, and the pointToPixel function takes any point and turns it into a pixel (since the

How to convert from UTM to LatLng in python or Javascript

梦想的初衷 提交于 2019-11-27 11:03:20
I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map. I have found some online calculators that does this, but no actual code or libraries. http://trac.osgeo.org/proj4js/ is a projection library for Javascript, but looking at the demo it doesn't include UTM projection. I am still pretty fresh to the entire GIS domain, so what I want is something ala: (lat,lng) = transform(easting, northing, zone) Staale I ended up finding java code from IBM that

Convert Lat/Longs to X/Y Co-ordinates

二次信任 提交于 2019-11-27 06:25:44
I have the Lat/Long value of New York City, NY; 40.7560540,-73.9869510 and a flat image of the earth, 1000px × 446px. I would like to be able to convert, using Javascript, the Lat/Long to an X,Y coordinate where the point would reflect the location. So the X,Y coordinate form the Top-Left corner of the image would be; 289, 111 Things to note: don't worry about issues of what projection to use, make your own assumption or go with what you know might work X,Y can be form any corner of the image Bonus points for the same solution in PHP (but I really need the JS) A basic conversion function in js

Mercator longitude and latitude calculations to x and y on a cropped map (of the UK)

断了今生、忘了曾经 提交于 2019-11-26 17:18:38
I have this image: http://imgur.com/99tSz.png . A map of the UK (not including Southern Ireland). I have successfully managed to get a latitude and longitude and plot it onto this map by taking the leftmost longitude and rightmost longitude of the UK and using them to work out where to put the point on the map. This is the code (for use in Processing.js but could be used as js or anything): // Size of the map int width = 538; int height = 811; // X and Y boundaries float westLong = -8.166667; float eastLong = 1.762833; float northLat = 58.666667; float southLat = 49.95; void drawPoint(float

How to convert from UTM to LatLng in python or Javascript

妖精的绣舞 提交于 2019-11-26 15:25:07
问题 I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map. I have found some online calculators that does this, but no actual code or libraries. http://trac.osgeo.org/proj4js/ is a projection library for Javascript, but looking at the demo it doesn't include UTM projection. I am still pretty fresh to the entire GIS domain, so what I want is something

Convert Lat/Longs to X/Y Co-ordinates

独自空忆成欢 提交于 2019-11-26 12:02:12
问题 I have the Lat/Long value of New York City, NY; 40.7560540,-73.9869510 and a flat image of the earth, 1000px × 446px. I would like to be able to convert, using Javascript, the Lat/Long to an X,Y coordinate where the point would reflect the location. So the X,Y coordinate form the Top-Left corner of the image would be; 289, 111 Things to note: don\'t worry about issues of what projection to use, make your own assumption or go with what you know might work X,Y can be form any corner of the