Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

416
Views
Utilice WMS externo para recuperar teselas con proyección EPSG:6706 en Mapbox

Estoy tratando de agregar un WMS externo como fuente usando mapbox-gl. Sé cómo hacerlo cuando el WMS soporta EPSG:3857, como se explica aquí . Desafortunadamente, el servicio WMS que necesito usar no es compatible con esa proyección, por lo tanto, no puedo usar {bbox-epsg-3857} en la URL de mosaicos para ocuparme del parámetro del cuadro delimitador. Basado en esta solución para Google Maps, probé un enfoque similar. Sin embargo, el método mapbox-gl addSource no admite una función como parámetro y no sé cómo pasar las variables x, y y zoom para obtener las coordenadas del cuadro delimitador convertidas a EPSG:6706. ¿Que me estoy perdiendo aqui? ¿Hay otro enfoque viable para obtener el mismo resultado?

 function bbox(x,y,z) { bl_lng=tile2long(x,z); tr_lng=tile2long((x+1),z); bl_lat=tile2lat(y+1,z); tr_lat=tile2lat((y),z); bl=proj4("WGS84","EPSG:6706",[bl_lng,bl_lat]); tr=proj4("WGS84","EPSG:6706",[tr_lng,tr_lat]); return bl[1]+","+bl[0]+","+tr[1]+","+tr[0]; } function tile2long(x,z) { return (x/Math.pow(2,z)*360-180); } function tile2lat(y,z) { var n=Math.PI-2*Math.PI*y/Math.pow(2,z); return (180/Math.PI*Math.atan(0.5*(Math.exp(n)-Math.exp(-n)))); } function checkWms(map){ proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"); proj4.defs("EPSG:6706", "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs"); if(!map.getSource('wms-overlay-source')){ map.addSource('wms-overlay-source', { 'type': 'raster', 'tiles': function(coord, zoom) { return "https://wms.cartografia.agenziaentrate.gov.it/inspire/wms/ows01.php?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX="+bbox(coord.x,coord.y,zoom)+"&CRS=EPSG:6706&WIDTH=256&HEIGHT=256&LAYERS=province,CP.CadastralZoning,acque,CP.CadastralParcel,fabbricati,codice_plla,simbolo_graffa&STYLES=default&FORMAT=image/png&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE" }, }); } if(!map.getLayer('wms-overlay-layer')){ map.addLayer({ 'id': 'wms-overlay-layer', 'type': 'raster', 'source': 'wms-overlay-source', 'paint': {} }); } }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!