git status

parent bfe050b4
......@@ -168,11 +168,10 @@ function drawPolygon(element) {
var input_text = polygon.city;
if (polygon.geojson.properties.NOMGEO != "Ciudad de México" && polygon.geojson.geometry) {
var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates);
if (polygon.geojson.geometry) {
//var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates);
// var biggest = osmap.getBiggestPolygon(coords);
osmap.addPolygon(coords);
osmap.addGeoJson(polygon.geojson);
input_text += ", " + polygon.state
} else {
osmap.addWKTPolygon(polygon.wkt_polygon);
......
......@@ -124,6 +124,31 @@ OpenStreetMapsClass.prototype.addPolygon = function(coords)
this.showCoords(feature.getGeometry());
}
//------------------------------------------------------------------------------
/**
* Draw a polygon in the map
* @param geojsonObject geojson to draw
*/
OpenStreetMapsClass.prototype.addGeoJson = function(geojsonObject)
{
// create source
var format = new ol.format.GeoJSON({
dataProjection: 'EPSG:4326',
featureProjection:"EPSG:3857"
});
// create feature
var feature = format.readFeature(geojsonObject);
// fit zoom with animation,
this.map.getView().fit(feature.getGeometry(), {duration: 1000, padding: [0, 0, 70, 0]});
// add feature to map
this.vectorLayer.getSource().addFeature(feature);
// show coords
this.showCoords(feature.getGeometry());
}
//----------
//------------------------------------------------------------------------------
/**
* Draw a polygon in the map
* @param wkt coords int wkt format to draw
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment