New answers tagged

3

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....


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.


0

Here is a simple demo, data from 2 different GeoJSON files. http://www.gistechsolutions.com/leaflet/DEMO/sports/index2.html It's just like your example, but it has 2 layers. Basically you have 2 urls, one for each source. and a simple layer control to turn them on or off. https://leafletjs.com/reference-1.5.0.html#control-layers


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 ...


2

There are several things that are wrong here: Syntax of coordinates definition in GeoJSON is not OK, but I suppose that just because of copying for question. features property of GeoJSON is an array, so you have to use index when refering to individual elements, in your case this would be RG.features[0].geometry.coordinates. Since in your case geometry is ...


3

The following code should do what you want. There might be a slightly more elegant way to write it, but I understand your request to pull out each polygon into their own file. import json import os directory = "c:/temp/json" with open(os.path.join(directory, 'geo.json')) as f: d = json.load(f) for part in d['features']: fName = part["properties"][...


0

If you want to have an image specified to a single file, then you must use the following code: onEachFeature: function (feature, layer) { layer.bindPopup("<h1><u><font color='red'>"+feature.properties.Title+"</h1></u></font><h2>Address: "+feature.properties.Head+"</h2><p><a href='images/" + ...


0

It looks like this solution is worth to use: Changing image size in JSON file after a couple forther advices I modified my code like this: onEachFeature: function (feature, layer) { layer.bindPopup("<h1><u><font color='red'>"+feature.properties.Title+"</h1></u></font><h2>Address: "+feature.properties.Head+...


0

The shapefile can be found here: http://thematicmapping.org/downloads/world_borders.php


1

Looks like I found what I needed: The example is under this link: http://www.gistechsolutions.com/leaflet/DEMO/baseball/BaseballPanelSelect2.html


2

Open the console (F12) you will see GeoJSON for the selected markers. So the data is there. In one of the simple examples, I use forEachFeature's on.click event to post the attributes to a HTML table (http://www.gistechsolutions.com/leaflet/DEMO/baseball/BaseballPanel.html) The issue I see is if you select 1 marker, the table is simple to populate, if you ...


0

I am posting this late answer just as a service for the community, since this is one of the questions that pop up when looking for "converting ESRI Shapefiles to GeoJSON with PHP". My PHP Shapefile library can read and write any ESRI Shapefile and convert it natively from/to WKT and GeoJSON. It is a free, open source, native PHP library, does not require ...


2

OpenLayers sets the CRS/SRS of a WMS from the projection specified in the source options, or if none is specified from the view projection so anything you put in params would be overriden (the API says WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically): source: new ol.source.TileWMS({ url: 'xxxxxxx', ...


1

You have this project that uses OpenStreetMap - http://openpoimap.org/ https://wiki.openstreetmap.org/wiki/OpenPoiMap. With overpass api https://wiki.openstreetmap.org/wiki/Overpass_API you can extract that info


1

Here you have a solution to export to json and for export it to kml. Everything is obtained from this official thread of Cesium. Update: They are links that talk about the question and there isn't method to do that native in Cesium, such as exportKml. To implement exportJson (for example), it should be done using pure js or Turf as you did. You can use ...


0

Turf.js can create convex hull from geojsons. https://turfjs.org/docs/#convex


0

It's not possible to pull Geojson directly from OSM / Overpass from what I can tell. Here's a workaround. First make a request to overpass and return XML. Then convert the XML to Geojson using osm2geojson (originally a JS package but recenlty adapted for PY) import requests import osm2geojson response = requests.get('https://overpass-api.de/api/...


Top 50 recent answers are included