Hot answers tagged

4

max_area_polygon; max_area = 0 ; for(poly in (feature.geometry.coordinates)){ polygon = turf.polygon((feature.geometry.coordinates)[poly]) area = turf.area(polygon); if(area > max_area){ max_area = area max_area_polygon = polygon // polygon with the largest area } } center = turf....


3

OpenLayers passes the extent in view projection units so you should use that if your server supports it (otherwise you would need to transform the extent to EPSG:4326) url: function (extent, resolution, projection) { return 'http://localhost:8080/geoserver/misproject/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=misproject%...


3

You could do this using overpass that already returns a geojson object and then, if you want, you can use the geojson package to convert this object into string or save it in a file. import overpass import geojson api = overpass.API() # api.get already returns a FeatureCollection, a GeoJSON type res = api.get(""" area[name="Granollers"][admin_level=8];...


2

Finally I exported the shp in GeoJSON, I took polylines' coordinates inside notepad and saved them in another txt file; then I imported in matlab the rows where I fliped all long/lat point coordinates and save in another txt file, so I could copy and paste a linestring such as: [[44.26260443366192, 7.665320437787832],[44.262391856609895, 7.664849184556104],....


2

The getData() function is indeed not very usefull as it return exactly what is stored in the variable geoJson But the main problem is that you are requesting the images using HTTPS from a website (http://freakplaces.com) that is not secured. Change the urls to HTTP and it will work ;) Demo : https://jsfiddle.net/fg3dorpj/


1

The issue has been resolved. A main thing was the injection of pointToLayer: function (feature, latlng) { feature.properties.myKey = feature.properties.Title + ', ' + feature.properties.Head return L.circleMarker(latlng, geojsonMarkerOptions); }, into the L.geoJson(geojson, { onEachFeature: OnEachFeature} So now, the full code looks ...


1

After reading and searching it was quite easy: instead of using fetchall() I only had to use fetch() since my view only returns one single row. I get the data by choosing the first result of the returned array. $result = $conn->query($query); $geojson = $result->fetch(); echo($geojson[0]); This works now fine.


1

This can be used using GDAL. First, install GDAL for your OS. You can convert files from the terminal by using following command: #ogr2ogr -f GeoJSON -t_srs crs:84 [output_filename].geojson [input_filename].shp If you want to use python script then by calling subprocess, this can be achieved. Python script example is given below: #Convert Esri .shp file ...


1

Instead of GeoJSON object you are passing Leaflet layer as first parameter to geoJson2heat function (see https://geomappando.com/2016/11/08/come-realizzare-una-heatmap-con-leafletjs/). You don't need to create GeoJSON layer. Just pass GeoJSON object to geoJson2heat function: var punti_mappa = geoJson2heat(geojsonLayer.responseJSON, 4);


1

You could convert them into GeoJSON files with just the LineStrings and then open them. For example on windows using ogr2ogr in the folder (assuming the files end in .geojson, and new files will be called file_line.geojson): for /R %f in (*.geojson) do ogr2ogr -f "GeoJSON" "%~dpnf_line.geojson" "%f" -where "OGR_GEOMETRY='LineString'" Then you can load ...


1

If you take a look at actual GeoJSON data, you'll see that it's coded in EPSG:4326, so reading features statement should be: var features = (new ol.format.GeoJSON()).readFeatures(data.geometry, {dataProjection: 'EPSG:4326', featureProjection: 'EPSG:27700'}); You'll also have to change order of layers in map declaration, otherwise features will be covered ...


1

According to the GeoJSON specification https://tools.ietf.org/html/rfc7946#page-7 the coordinates should be in order lon lat. Your data seems to have order lat lon.


1

I will assume that you are using the 4.x version of the API since it seems GeoJSONLayer was implemented in 4.11. Remember that you have to define the modules and classes you will use on top of your script. I see you are calling several modules and classes but GeoJsonLayer is not listed (hence the error you are getting). If you take a look at the ...


Only top voted, non community-wiki answers of a minimum length are eligible