Hot answers tagged

9 votes
Accepted

Make polygon of GeoJSON layer unclickable after first click in Leaflet

One possible solution would be to use some custom polygon/layer property, like for example wasClicked (name can be any, as long is does not conflict with standard Leaflet layer properties), to mark ...
user avatar
  • 17.2k
8 votes
Accepted

Does GeoJSON not support different projections?

The obsolete GeoJSON 2008 specification has a "crs" member to define a coordinate reference system (including projected). GDAL/OGR has a RFC7946 layer creation option, with default NO (thus ...
user avatar
  • 39.9k
8 votes

GeoJSON format to CSV

This particular GeoJSON has a list of nested dictionaries as one of its properties. The following script downloads the GeoJSON, creates a point layer which is added to the map canvas, and extracts the ...
user avatar
  • 7,291
7 votes

Fetching the on-click data from the website into QGIS

In eclipsewise.com, the pop-up window's id is mapmaker. So, you can use the same JavaScript code in the same way. The script copies the pop-op content to the clipboard. function copyToClipboard(text) {...
user avatar
6 votes
Accepted

Converting ArcGIS Spatially Enabled Dataframe to GeoJSON

Neither the API documentation nor dir(pd.DataFrame.spatial) has any indication that there is a to_geojson() method. So there is no direct way to do this as far as I know. However, instead of using ...
user avatar
  • 1,316
6 votes

GeoJSON API in QGIS

WMS is a protocol for image data (such as a PNG or JPEG). To directly access a GeoJSON via a URL you can use the Add Vector Layer dialog (Layer -> Add Layer -> Add Vector Layer...). Set the ...
user avatar
  • 7,291
6 votes
Accepted

Convert GeoJSON geometry to new coordinate system and WKB format in python

The coordinate system of GeoJSON may be EPSG:3857. You can use the following script import json import shapely from shapely import wkb, wkt from shapely.geometry import LineString # Opening JSON file ...
user avatar
5 votes

Fetching the on-click data from the website into QGIS

This is a new answer with the new websites. Procedure : Go on the desired eclipse site on http://xjubier.free.fr, for example View the source of the webpage (right-click on the eclipse marker data ...
user avatar
  • 12.5k
5 votes
Accepted

Extracting the space between polygons

Try unary_union to dissolve all obstacles to a big multipolygon. Then create a rectangle around the multipolygon and difference: import geopandas as gpd df = gpd.read_file(r'C:\GIS\data\tempdata\my....
user avatar
  • 52.5k
5 votes
Accepted

GeoJSON will load from variable, but not from file in OpenLayers

When used in a Vector source the GeoJSON parser will attempt to transform coordinates from the default data projection for GeoJSONs (CRS:84) to the view projection. As your coordinates are already in ...
user avatar
  • 9,968
5 votes
Accepted

GeoJSON AttributeError('str' object has no attribute '_geom') - when converting to WKB format

You convert the geometry dict to string using json.dumps and pass the string to wkb.dumps() method. But it requires a shapely geometry. Therefore, you get 'str' object has no attribute '_geom' error. ...
user avatar
4 votes

Is it possible to get OSM data in geojson via overpass api using ipython?

It is possible now to retrieve a GeoJSON object of OSM relation with Overpass convert function, here is an example: [out:json]; ( way(51.477,-0.001,51.478,0.001)[name="Blackheath Avenue"]; ...
user avatar
  • 141
4 votes
Accepted

Updating the filter option for GeoJSON layer in Leaflet?

If you look at the Leaflet docs for GeoJSON layer at https://leafletjs.com/reference-1.7.1.html#geojson, you'll notice the following note for filter option: Note: dynamically changing the filter ...
user avatar
  • 17.2k
4 votes
Accepted

QGIS attributes table shows wrong data when printing Timestamp with Milliseconds

In the first case, QGIS adds the values as QTime objects and convert milliseconds to zeros. I don't know why. In the second case (d case), QGIS adds the values as string. Everything is as it should ...
user avatar
4 votes
Accepted

How to create an empty GeoJSON template with several empty fields (QGIS)

You can save this on your disk and edit the field names with any text editor { "type": "FeatureCollection", "name": "jsontemplate", "features": [ { &...
user avatar
  • 52.5k
4 votes
Accepted

Dataframe object is not callable

As @user2856 stated, sample is a DataFrame, not a function, you can't call it. That's, you cannot use it with parenthesis, like sample(. Other problems arise because the whitespaces consist of tabs ...
user avatar
4 votes

Access GeoJSON feature keys using Python

(1) In Example 1, it is normal you to get keys ['type', 'features'] because title in for title in data gives you a key of data. (2) data["features"] is a list and you have to specify index ...
user avatar
4 votes
Accepted

Populating all the data from GeoJSON to an HTML div

That's because you set $("graphs").html() to each element in turn, overwriting the previous content. Use $("graphs").append(content);, that should retain the previous content, or ...
user avatar
  • 3,543
3 votes
Accepted

Leaflet artifact on GeoJSON hexgrid without borders at zoom 10

It seems like some kind of a bug. I didn't go into details why this happens, just found a workaround with modifying style. Instead of stroke weight 0, it gets weight 1. Since polygons overlap, this ...
user avatar
  • 17.2k
3 votes
Accepted

ogr2ogr download GeoJSON from URL with parameters

You will find a working sample code below to directly get the data from the URL and push it to a PostGIS table (I've considered you already have an existing database and ran CREATE EXTENSION postgis; ...
user avatar
  • 28.7k
3 votes

Find turns in GPS coordinates

Here's how it can be achieved using QGIS: Convert the file to a geopackage (line geometry) using QGIS. Remove unnecessary fields (they can slow down further processing). Set the correct coordinate ...
user avatar
  • 5,682
3 votes
Accepted

Upload GeoJSON files to ArcGIS Online content

This Esri Community question contains the answer. To summarize (since the final solution is spread out over multiple answers): from arcgis.gis import GIS data_path = r'C:\path\example.geojson' gis = ...
user avatar
3 votes

Adding vector layer feature from REST API URL (HTTPS) in QGIS

It may be convenient to use a VRT file if you often use the same remote layer in different QGIS projects instead of copying/pasting it in each of them. Put in file myvrt_demo.vrt the following content ...
user avatar
  • 28.7k
3 votes
Accepted

Something wrong with GeoJSON for LineString

You have 3 levels of nesting in your coordinates which is not right for a simple linestring. Either make it a MultiLineString { "type": "FeatureCollection", "features&...
user avatar
  • 52.8k
3 votes
Accepted

Extracting skatepark data as JSON file

Use Overpass Turbo web interface, zoom to your region of interest, click Wizard and enter this string: sport:skate or sport:extreme. Using double points : instead of equal symbol =, it uses wildcards (...
user avatar
  • 41.1k
3 votes
Accepted

Does Geometry by expression in QGIS except layer without geometry?

The problem The problem with your expression is that you apply it on the Matrix layer, but this is a layer without geometry. Creating geometries works only on layers that contain geomtries. It does ...
user avatar
  • 41.1k
3 votes

Changing GeoJSON key name

Your input GeoJSON is invalid (copy paste it in https://geojsonlint.com). You can't expect a valid GeoJSON output from a bad input. So, first, you should replace all single quotes with double quotes. ...
user avatar
  • 28.7k
3 votes
Accepted

Dynamically fetching only related values instead of all attribute values in dropdown from GeoJSON in OpenLayers

There are a few things you have to do to make it work: Set variable featureNames with all the travel relations as global, so it will be available for filtering To Station when From Station is ...
user avatar
  • 17.2k
3 votes

Make polygon of GeoJSON layer unclickable after first click in Leaflet

I see (at least) four ways of achieving this, none of them being really clean: The (default) L.SVG vector renderer applies the interactive option only when a vector is added to the renderer. Thus, ...
user avatar
  • 9,390

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