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

272
Views
Cómo dibujar cadenas de varias líneas con objetos GeoJSON Openlayers

Estoy tratando de dibujar una cadena de líneas sosteniendo el objeto GeoJSON . Pero cuando comienza el proceso de dibujo, el puntero se puede seleccionar en cualquier parte del mapa. Mi propósito es que el puntero se seleccione en el objeto GeoJSON

Aquí hay algo del código.

 var jsonSource = new ol.source.Vector({ url: 'https://raw.githubusercontent.com/Kardelennkayaa/ankr_tdelay/main/KAMAN.json', format: new ol.format.GeoJSON(), }); var vector = new ol.layer.Vector({ source: jsonSource, background: 'white', }); map.addLayer(vector) var jsonSource_ank = new ol.source.Vector({ url: 'https://raw.githubusercontent.com/Kardelennkayaa/heroku_app/main/ankara_road.json', format: new ol.format.GeoJSON(), }); var vector_ank = new ol.layer.Vector({ source: jsonSource_ank, background: 'white', }); map.addLayer(vector_ank) var draw_lineString = new ol.interaction.Draw({ type : 'LineString', //source:drawSource_ls source:jsonSource }) draw_lineString.on('drawstart', function(evt){ drawSource_ls.clear() //select.setActive(true); }) draw_lineString.on('drawend',function(evt){ // alert('point is added') clickedCoord_lineString = evt.feature.getGeometry().getCoordinates() $('#ls_adding').modal('show'); console.log('clicked at', evt.feature.getGeometry().getCoordinates()) map.removeInteraction(draw_lineString) }) function startDrawing_lineString(){ map.addInteraction(draw_lineString) }

Y aquí está la interfaz web.

El objetivo es al hacer clic en Add LineString , la polilínea se puede dibujar con el objeto GeoJSON relativo. ¿Cómo puedo hacer eso? Gracias por adelantado.

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!