mercator

Getting pixel coordinated from google static maps

牧云@^-^@ 提交于 2020-02-08 06:58:45
问题 I want to find out the pixels coordinates of a lat/lng on an static map. For example i've downloaded an image from: Link to Image What I want is from a lat/lng long to be able to map that latlng to pixel coordinates. I've searched a bit and found that mercator projection can solve my problem. However I could not find any proper way of doing it. Can somebody please help me. Also I've zoomed to 9 when as shown in the URL . 回答1: Converting Lat/Lon to pixel for a google static map is very useful

Getting pixel coordinated from google static maps

我怕爱的太早我们不能终老 提交于 2020-02-08 06:58:12
问题 I want to find out the pixels coordinates of a lat/lng on an static map. For example i've downloaded an image from: Link to Image What I want is from a lat/lng long to be able to map that latlng to pixel coordinates. I've searched a bit and found that mercator projection can solve my problem. However I could not find any proper way of doing it. Can somebody please help me. Also I've zoomed to 9 when as shown in the URL . 回答1: Converting Lat/Lon to pixel for a google static map is very useful

d3.js mercator projection to NYC map

一笑奈何 提交于 2019-12-22 20:48:19
问题 I am making a map of the boroughs in NYC and I can't seem to get the projection right: the only thing I get is a tiny map. I tried recreating this example, which only made the console go crazy with errors, I suspect because there was something off about the equation. When I was trying to get albers to work, I tried out the answer to this question, and still I could not get the map to work. With 960/500 height and width, I used: var projection = d3.geo.albers().center([40.71, 73.98]).parallels

D3 mercator function NaN

纵然是瞬间 提交于 2019-12-22 06:29:10
问题 I'm not too familiar with the D3 mercator projection function, and I'm getting some unexpected results. I'd like to project the following latitude and longitude (somewhere in Mexico): var geo = [19, -99] I define my mercator projection using d3 var projection = d3.geo.mercator(); projection(geo) > [529.7418836818384, NaN] which is a point obviously not on a map. What exactly am I doing wrong? Thanks! 回答1: Javascript has it's lat and long round the opposite way to the rest of the world, so

D3 mercator function NaN

冷暖自知 提交于 2019-12-22 06:29:04
问题 I'm not too familiar with the D3 mercator projection function, and I'm getting some unexpected results. I'd like to project the following latitude and longitude (somewhere in Mexico): var geo = [19, -99] I define my mercator projection using d3 var projection = d3.geo.mercator(); projection(geo) > [529.7418836818384, NaN] which is a point obviously not on a map. What exactly am I doing wrong? Thanks! 回答1: Javascript has it's lat and long round the opposite way to the rest of the world, so

How to convert radius in metres to pixels in mapbox leaflet?

可紊 提交于 2019-12-12 09:44:29
问题 I am working on an application where I am trying to run some algorithms on a map and calculate coords but they are slightly off because I am running the calculations on latitude and longitudes and the final results are getting distorted. Now I am trying to convert all coordinates to EPSG3857 Web Mercator coordinates like so: var crs = L.CRS.EPSG3857; var zoom = terrainAnalysisMap.getZoom(); markerToPoint = crs.latLngToPoint(marker.getLatLng(), zoom); markerOnRadiusToPoint = crs.latLngToPoint

Calculating Mercator d3 scaling to match Leaflet zoom level

三世轮回 提交于 2019-12-11 05:28:00
问题 Given a Leaflet zoom level (0..22), how would I calculate D3 scaling value for geoMercator projection? At zoom=0, the whole world fits within a single tile (256x256). In tiles, the world size is 2^zoom x 2^zoom tiles. 回答1: For comparison with d3 scales for Mercator maps: A mercator map uses this formula: var point = [x, Math.log(Math.tan(Math.PI / 4 + y / 2))]; The scale factor in a d3 map essentially applies the following transform: point[0] = point[0] * k; point[1] = -point[1] * k; The

d3.js mercator projection to NYC map

我的未来我决定 提交于 2019-12-06 05:59:06
I am making a map of the boroughs in NYC and I can't seem to get the projection right: the only thing I get is a tiny map. I tried recreating this example, which only made the console go crazy with errors, I suspect because there was something off about the equation. When I was trying to get albers to work, I tried out the answer to this question, and still I could not get the map to work. With 960/500 height and width, I used: var projection = d3.geo.albers().center([40.71, 73.98]).parallels([29.5, 45.5]).scale(10000).translate([(width) / 2, (height)/2]); Right now, I am using a transverse

How to convert radius in metres to pixels in mapbox leaflet?

冷暖自知 提交于 2019-12-05 14:57:47
I am working on an application where I am trying to run some algorithms on a map and calculate coords but they are slightly off because I am running the calculations on latitude and longitudes and the final results are getting distorted. Now I am trying to convert all coordinates to EPSG3857 Web Mercator coordinates like so: var crs = L.CRS.EPSG3857; var zoom = terrainAnalysisMap.getZoom(); markerToPoint = crs.latLngToPoint(marker.getLatLng(), zoom); markerOnRadiusToPoint = crs.latLngToPoint(markerOnRadius.getLatLng(), zoom); Now I also have a radius which I will have to convert from metres to

D3 mercator function NaN

戏子无情 提交于 2019-12-05 11:26:35
I'm not too familiar with the D3 mercator projection function, and I'm getting some unexpected results. I'd like to project the following latitude and longitude (somewhere in Mexico): var geo = [19, -99] I define my mercator projection using d3 var projection = d3.geo.mercator(); projection(geo) > [529.7418836818384, NaN] which is a point obviously not on a map. What exactly am I doing wrong? Thanks! Javascript has it's lat and long round the opposite way to the rest of the world, so what you've given D3 is a longditue of 19 and a latitude of -99. Obviously there is no latitude of -99 hence