New answers tagged

0

I am not an expert but I would like to share what I did to tackle it. Since GeoJSON is basically a string, I added a string specifying the CRS (3857 in this example) manually. Might be useful to someone. json = geo_df.to_json() attr = grid_out.split(',', 1) json_with_crs = attr[0] + ', "crs": { "type": "name", "properties&...


1

Copy of my answer from SO: GeoPandas uses fiona to handle most of the stuff within read_file and it seems that fiona is unable to handle list in this case. But GeoPandas can also generate JSON by itself, and it seems that in that case, it works correctly. Using that second gdf made from pandas: >>> print(gdf.to_json(indent=4)) { "type":...


4

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 and spaces as in the image. To solve the problem you need to use delim_whitespace=True in pd.read_csv. Use the following script. You need also folium, ...


2

You'd want to run: SELECT JSONB_BUILD_OBJECT( --aggregate features into FeatureCollection 'type', 'FeatureCollection', 'features', JSONB_AGG(features.feature) ) AS featurecollection FROM ( --subquery to generate GeoJSON Features from "table_rows", aliased "AS features" SELECT JSONB_BUILD_OBJECT( --...


1

If you are not well with programming, you can always choose an option for web-based converters like this below: https://www.convertcsv.com/geojson-to-csv.htm It will, unfortunately, require you to save your data as a separate file and upload it to the converter.


8

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 timestamp and associated data for each dictionary in the feature's property. A Pandas' DataFrame is made from the data and it is ultimately saved to a CSV and ...


2

You can use countries.eachLayer group layer method to iterate through layer features and then use turf.booleanIntersects method to check which country feature intersects polyline. To log intersected countries on the console, code could then look something like this (assuming feature property name contains country name): var polyline = L.Polyline(polylineData)...


0

I believe that you are out of luck with ogrmerge which simply takes several inputs and appends then to one output. I am not sure if GDAL has a mechanism for making comparison between different data sources. Certainly you can filter the duplicates from the output but I believe that you would like to get rid of duplicates as early as possible. There is a ...


5

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 Source Type to Protocol HTTP(S), cloud, etc, Type to HTTP/HTTPS/FTP, and enter your URL. Clicking Add will give you a list of available layers. Alternatively, you ...


0

By the information that the GeoJSON contains it is impossible to know the georeferenced location of the features. "coordinates": [ 417,2912] are in some units but because GeoJSON does not tell the coordinate system they are just plain numbers. Mapbox has probably documented their API, try to find the information from there. But because the numbers ...


4

You can save this on your disk and edit the field names with any text editor { "type": "FeatureCollection", "name": "jsontemplate", "features": [ { "type": "Feature", "properties": { "a1": "", "a2": "", "a3": "", "...


2

You can load that string into a GeoDataFrame using the read_file method: import geopandas as gpd gdf = gpd.read_file(geojson_str, driver='GeoJSON') In the code above, gdf is a CRS-aware GeoDataFrame that you can manipulate however you want. Credit Special credit to @tynowell for highlighting that this is possible in an unrelated thread.


0

You can save the geojson as plaintext in a separate script, and then call it inside your main script as a geometry. var geometry = require('users/repo/path:geojson').getGeometry(); See explanation here https://medium.com/@HarelDan/gee-plaintext-geometry-assets-b85712bcd142


1

JQuery $.ajax method does not return the data, but promise to fetch the data. This means you have to turn your GeoJSON data fetch inside out: var load_features; $.ajax({ type: 'GET', url: 'scripts/load_features.php', dataType: 'json', success: function(data, status) { load_features = new ol.format.GeoJSON().readFeatures(data); } });


Top 50 recent answers are included