New answers tagged

2

I'll just copy-paste my response to Leaflet bug #6173 : I'm reading the OGC's Simple Feature Access specification (again), to remind myself about the formal definitions of Polygons and MultiPolygons. Let me quote page 31: 6.1.14 MultiPolygon A MultiPolygon is a MultiSurface whose elements are Polygons. The assertions for MultiPolygons are as follows. a) The ...


0

Finally, I have resolved the problem points = [] for u,v,data in G.edges(keys=False, data=True): if 'geometry' in data: xs,ys = data['geometry'].xy point = list(zip(xs,ys)) if not data['oneway']: points.append(point) gdf = gpd.GeoDataFrame({'geometry': [LineString(l) for l in points] }) gdf.set_geometry('geometry', ...


0

To have parallel side, I tried this : points = [] for u,v,data in G.edges(keys=False, data=True): if 'geometry' in data: xs,ys = data['geometry'].xy point = list(zip(xs,ys)) if not data['oneway']: points.append(point) gdf = gpd.GeoDataFrame({'geometry': [LineString(l) for l in points] }) gdf.set_geometry('...


0

You can give a try to BulkVectorExport plugin, which exports all vector layers in the actual project to a given format and SRS. See https://github.com/zsiki/bulkvectorexport


0

You can also use this official GDAL recipe if you prefer command line ogr2ogr -f CSV -dialect sqlite -sql "select AsGeoJSON(geometry) AS geom, * from input" output.csv input.shp


5

You need to set Layer Options > GEOMETRY to any option except <Default> in Save Vector Layer as... window.


1

Use setStyle() instead of modifing the property. const onEachCountry = (country, layer) => { console.log(country.properties.color) //This shows me that some of the country colors has been changed layer.setStyle({fillColor: country.properties.color}); // this should change the color of the map according to country.properties.color. But even after ...


0

You have probably problem with installing Python and/or GDAL Python bindings. I guess that other Python utilities like gdal_calc.py will fail as well. When it comes to another problem, some Windows builds have had an issue with wildcards. They appeared after some Windows update. OSGeo4W and ones from gisinternals should work now. Otherwise make a list file ...


0

https://github.com/phildionne/geojson_model is nice require 'geojson_model' require 'json' locations = [] locations << GeojsonModel::Feature.new( properties: {name: 'Null Island'}, geometry: GeojsonModel::Geometry.new(type: 'Point', coordinates: [0, 0]) ) locations << GeojsonModel::Feature.new( properties: {name: 'Kraków'}, ...


0

The question title in the linked post https://stackoverflow.com/questions/35459896/format-complex-nested-objects/35472272 DOESN'T mention anything of Mapbox layer or Mapbox features. I will just post the answer from the linked post below. Here's how you iterate the features object, and create something human-readable out of it. Explanation in the comments: ...


0

Perhaps slicing the features array would work? So, something like: var newGeoJSON = geojson; newGeoJSON2.features = geojson.features.slice(-100); The negative index (-100) indicates an offset from the end of the array. This approach assumes that the features array contains more than 100 elements. Depending on your situation that would be something to test ...


3

You can use the geometrygenerator to display parts of your multilinestring in different colors. With the expression: geometry_n($geometry,2) you will get the second part of the multilinestring. Then you can choose a color or special linestyle for that. see image below. It is one Multilinestring with 3 parts in different colors.


0

yikes, so the above is fine. the code was throwing "NaN" due to inconsistencies (capitalisation) in the 'covid' field in df. Sorry if I have wasted anyone's time.


1

GPX XML schema definition (see https://www.topografix.com/GPX/1/1/) states that <trk> element can have several members that describe it. Leaflet-omnivore plugin you are using to read GPX brings only two of them as feature properties to GeoJSON layer: <name> and <desc>. You are already using the first one to name your tracks, so you can use ...


0

The "JSON to Features" tool in ArcGIS Pro will allow you to output directly to a geodatabase.


0

Since GeoJSON layer in question is not big, the simplest solution would be to iterate through all the layers/features of GeoJSON layer and set style for those that have desired num_mur property. Code could the look something like this (not tested): function setMurStyle(selLayer, style) { var numMur = selLayer.feature.properties.num_mur; lat_murs....


1

You need to ensure you're using the OSTN15 transformation from Ordnance Survey if you're going from OSGB to WGS84. In my experience DotSpatial doesn't use this which results in the shift you're seeing. QGIS does I believe out of the box. Details here: https://www.ordnancesurvey.co.uk/business-government/tools-support/os-net/for-developers Can't help getting ...


0

By the documentation SpatiaLite does have ST_Subdivide function. http://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html Divides geom into many parts until each part can be represented using no more than max_vertices. If the optional argument max_vertices is not explicitly specified a limit of 128 vertices is implicitly assumed. NULL will be returned on ...


0

XMLHttpRequest cannot load http://localhost/Web%20Mapping/fond.geojson. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. Answer Goto IIS Manager and Try to add below value in HTTP Response for virtual folder (enter inetmgr in run command) Name: Access-Control-Allow-Origin Value: *


1

Here is a full answer with a if ... else if ... else condition : filter: function(feature, layer) { if (varState == "01") { return (feature.properties.field1 == "yes" && feature.properties.field2 == "yes"); } else if (varState == "02") { return (feature.properties.field1 == "yes"...


1

As I said in my answer the GeoJSONDatastore module is unsupported that means that you use it at your own risk and accept the need to investigate and fix any issues you may find using it. I had a quick look over the weekend and I can get the latest (25-SNAPSHOT) version to install into GeoServer but not actually display the data on a map. Feel free to proceed ...


1

According to https://gis.stackexchange.com/a/367255/109339 the GeoTools GeoJSON Datastore "lacks the GeoServer wrapper that would provide you with a GUI element to allow you to set it up easily". Maybe there is a way to configure a datasource.xml in the data-directory of GeoServer, but I don't know or found an example.


0

For Java and JavaScript I use ports of PROJ, being Proj4J and Proj4js. According to language bindings there is a PROJ VB Wrappers, which is also mentioned in C# Library for converting Shapefile Projection question on StackOverflow, but the server seems down. Maybe ProjNet (for GeoAPI) suits your needs. From personal experience I know that the Java and ...


0

you may try using folium.plugins.HeatMap() this source has converted geo.json to feature group for using HeatMap() method. You may have a look: https://ocefpaf.github.io/python4oceanographers/blog/2015/11/16/folium_quiver/


1

pgRouting functions return an ordered list of nodes that describe the route. When you join the result with your network table to retrieve the geometry of the route, the linestring geometries are not necessarily in the correct direction. To bring them in the right direction, you need to compare the route's node ID's with the source and target value of the ...


1

As @IvanSanchez wrote in his answer, problem comes from clicking on the default marker, which has no setStyle method. And there is definitely no need for two layers from the same GeoJSON source. Solution for what you want to achieve is to use just pointToLayer method to create marker and click event. Code could the look something like this: var clicked; var ...


0

I do answer my own question if someone with the same question finds this topic: 1: In the handsontable intit: afterChange: function (changes, src) { if (src !== 'loadData') { var editedRow = this.getDataAtRow(changes[0][0]); for (key in drawnItems._layers) { ...


1

The way is simple. You just need tobound your whole file in the JavaScript code and attach it to your map. It has been explained here: http://www.mkrgeo-blog.com/excel-spreadsheet-batch-data-geocoding-for-geojson-and-json-files/ If I would bring your example here it could look like this: var file = { your JSON data } Next save this file as the .js file ...


1

Your code (which I adapted into a reproducible example here) is adding the dataset twice to the map, once as L.CircleMarkers... var trainGeo = L.geoJSON(wtsGeo, { pointToLayer: function (feature, latlng) { return L.circleMarker(latlng, tMarker); }, }); ...and once as default L.Markers... var clickLayer = L.geoJSON(wtsGeo, { style: ...


0

I managed to solve this by marking the coordinates with array numbers and setting them into the correct order for the rendering into leaflet. Another way would be using the leaflet method 'l.geojson.coordstolatlngs()' to switch the lat and lng coordinates. {this.state.schoolList.length > 0 && this.state.schoolList.map(({ ...


0

This script is assuming you want to save the bounds of all the raster layers. import json layers = [layer for layer in QgsProject.instance().mapLayers().values() if layer.type() == QgsMapLayerType.RasterLayer] gj = { "type": "FeatureCollection", "features":[] } for layer in layers: extent = layer.extent() feature =...


0

Leaflet has only one standard blue icon for markers, so if you want to have markers with different icons, you'll have to create them yourself (see https://leafletjs.com/reference-1.7.1.html#icon). Since you have two different GeoJSON layer sources and want to have different markers for each source, the simplest way is to create two separate layers, where you ...


1

GeoTools (which provides the underlying data management for GeoServer) has an unsupported GeoJsonDatastore (gt-geojsonstore) which would allow you to publish GeoJson files via GeoServer if you drop the jar file into the WEB-INF/lib folder. But it would be very slow and would lack the nice GUI of a finished data plugin. GeoJSON is better suited as a transfer ...


0

For GeoJSON this sort of works (adjust -c to your needs): head -c 1000 HPG_2019_simplified.geojson prints: { "type": "FeatureCollection", "name": "HPG_2019_simplified", "crs": { "properties": {"name": "EPSG:31287"}, "type": "name" }, "features": [ { ...


1

The Loader wasn't receiving the data sent by Post. So, now the page where I do the query, receives the data in json format. Also I removed the vecLayer from the Map Layer Array, and added it to the map later because the vecLayer doesn't exist. I put it all in one function, and now it works. I would have to adjust map.getView (). fit (vectorParcels.getExtent (...


Top 50 recent answers are included