Multiple points openlayer and only show the last -
please me problem.
i have route finder shows both list , map various points vehicle has passed. when click on item in list, point can seen in map, when have 2 points in same location (eg point1, point2), shows me last point (point2)
i have no idea how when click point1 point placed above point2 , vice versa
my code is:
// when clic in item of list function searchpoint(x, y, zoom) { if (x != 0 && x != '0' && x != '0.0') { map.setcenter( new openlayers.lonlat(x, y).transform( new openlayers.projection("epsg:4326"), map.getprojectionobject() ), zoom ); } } layerrutaspuntoshistorial = new openlayers.layer.vector("rutas puntos historial", { //rendereroptions: { zindexing: true }, strategies: [new openlayers.strategy.fixed()], protocol: new openlayers.protocol.http({ url: "trackweb.asmx/obtenerrutaspuntoshistorial", readwithpost: true, params: { iddispositivo: $("#ddldispositivos").val(), tipo: $(".datavalor.active").attr("data-valor"), fechainicial: $("#txtfechadesde").val(), fechafinal: $("#txtfechahasta").val() }, //params: { iddispositivo: $("#ddldispositivos").val(), tipo: $(".btntile.selectdates.selected").attr("data-valor"), fechainicial: $("#txtfechadesde").val() + " " + $("#ddhorain").val() + ":" + $("#ddminutoin").val() + ":00", fechafinal: $("#txtfechahasta").val() + " " + $("#ddhoraout").val() + ":" + $("#ddminutoout").val() + ":00" }, headers: { "content-type": "application/json; charset=utf-8" }, format: new openlayers.format.geojson(), contenttype: 'application/json; utf-8', datatype: 'json', async: true }), stylemap: stylesrutas }); var stylesrutas = new openlayers.stylemap({ "default": new openlayers.style(null, { rules: [ new openlayers.rule({ symbolizer: { "point": { pointradius: 6, graphicname: "circle", fillcolor: "#f78f1e", fillopacity: 1, strokecolor: "#f78f1e", labeloutlinecolor: "#f78f1e", cursor: "pointer", label: "${numero}", fontcolor: "#fff", fontopacity: 1, fontfamily: "arial", fontsize: 9, fontweight: "600", //graphiczindex: 10, //labelzindex: 10, //graphiczindex : 9999999, //zindex: 99999999, } } }) ] }) });
you looking x,y inside geojson file. logically, computer find , render items in order retrieved, point1 first, point2 second. since not providing names computer, there no way computer understand point want.
example set: {{x,y},{x,y},{a,b},{c,d},{e,f}}
now asking computer {x,y}
how know, 1 want? doesn't. 1 {x,y}
no different other, far knows.
you reverse sort geojson file, run reverse of situation, want display second point rather first one. if don't care - reverse sort geojson.
Comments
Post a Comment