New answers tagged

0

Mapshaper.org is a handy free online tool that allows you to upload a geojson file, display it as a map, then choose one of three simplification alogrithims which you can adjust the strength of with a slider. It updates the map and highlights in red any places where there's a loss of integrity like an overlap between two regions. There's a 'fix' button that ...


0

When you initialize the L.geoJson layer group that you will use as argument of Leaflet Omnivore plugin, you can take advantage of the onEachFeature option to copy a reference of your features into other groups, or even to duplicate your features. var subGroups = []; var myGroup = L.geoJson(null, { onEachFeature: function (feature, layer) { var ...


1

The OpenStreetMap’s French community are maintaining a rather exhaustive and accurate set of maps. Whether you’re a cartographer, a graphic designer or a developer, they’ve made it easy to reuse their work. As a matter of fact, from the OpenStreetMap’s OSM format, they’ve exported the maps to various formats such as Shapefiles, SVG, GeoJSON (to mention a few ...


0

The kde values from MASS::kde2d are stored as a matrix. The array coercion is to create a vector with the correct length. However, you cannot export an sp DataFrame object with an array in the @data slot and for some reason the function is not outputting a vector column. You can simply coerce the offending column into a vector using as.vector and overwriting ...


4

I like to use the json_build_object function. SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM ( SELECT 'Feature' As type , ST_AsGeoJSON(lg.geometry)::json As geometry , json_build_object( 'attribute1', attribute1, 'attribute2', ...


0

You need to have "write" access to the data source. In this case the data source is a web page resulting from a query. One solution is to create a copy of the data source in the computer's memory, and, then add to that memory: #create an output datasource in memory mem_driver=ogr.GetDriverByName('MEMORY') source = mem_driver....


0

for OL3 it's a bit complicated since you'll have to read both features from both sources and do an union to them then you load them to a vector layer, the union itself is made with turf you can download it from here: var feature1,feature2; var union=turf.union(feature1,feature2); var formatGeoJSON= new ol.format.GeoJSON(); var yourResult=formatGeoJSON....


0

You have to merge your polygons before displaying them. The accepted answer in this question explains how to achieve that in detail.


0

That worked for me: open geoJSON in a text-editor and put following code in front of geoJSON code: var zabudowaJSON_l = Don't ask me why that works, it worked for me. Here is an example var zabudowaJSON_l = { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [ { "...


2

Try to disable the "Support on the fly geometry simplification" parameter in the postgis store configuration in GeoServer. And make sure your polygon stays within the "world" boundaries, best if it's not touching the datelines. Also disable "advanced projection handling" in the WMS settings


1

Esri has some JavaScript libraries that will get you from GeoJSON to ArcGIS Server JSON. Terraformer ArcGIS Parser arcgis-to-geojson-utils (Despite the name, it converts in both directions)


0

The GeoJSON format and the ArcGIS Server JSON format (ArcGIS Server REST API:geometry) are simple Python dictionaries There are many Python spatial modules which have the Geo_interface protocol (GeoJSON like)(list of modules with examples). For example with Fiona import fiona lines = fiona.open("a_shapefile.shp") # first feature of the shapefile line = ...


1

Instead of the CARTO SQL API, you can insert your geojson sample to a CARTO column value (geojson_data, for example). And then use the PostGIS ST_GeomFromGeoJSON and set the_geom to the result: UPDATE name_table SET the_geom = ST_GeomFromGeoJSON(geojson_data) You will end up with this dataset/map.


0

As for animating a path, you might be interested in using Leaflet.Polyline.SnakeAnim plugin, instead of trying to achieve the result through D3. You just have to create the intermediate L.polyline's between each point in your GeoJSON data, possibly adding the point themselves (as L.marker's), then call snakeIn() on the resulting Layer Group. Demo: http://...


1

If the problem is that "feature.properties.name is undefined" just pass the feature into openSidedbar. And if you want to display "this is A" or "this is B" pass that feature parameter into html (assuming that sidebar is a jQuery object): UPDATE function onEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, mouseout: ...


2

Might just need e.target or e.layer before feature.properties.name - console.log is your friend here and will likely answer your question.


8

According to Romain D on it1me.com, it can be done with the Leaflet.PolylineOffset as referenced in the comments by MattPil29 above. I have adapted it for the data in your example. I turned off your original line by changing opacity to 0 in myStyle. There is probably a more elegant way to not add it. The other key is flipping the x,y coordinate to make L....


2

It is pretty simple actually, you just need to iterate through the features of the geojson structure once you have got it in a dictionary format (like from the json.load() function). I don't work with GeoServer WFS services, but I did find a json example online. The first shows just how to iterate through the json and get an arcpy.Geometry object back. ...


2

It's worth noting that the encoding format you are using is Google's Encoded Polyline Algorithm Format. I was also not able to find a tool that converted directly from EPAF to GeoJSON, but I did find a mapbox project on Github that provides the functionality in JavaScript. As you said you are not a coder, I wrapped the functionality into a JSFiddle for you ...


0

I tried to approach this from as many angles as possible, and I finally found something that worked. Instead of converting the .shp to .geojson using ogr2ogr, I loaded the .shp into QGIS and then saved it as .geojson. Like stated previously, this file itself cannot be loaded into mongodb directly, so I used $ jq --compact-output ".features" counties....


2

I couldn't get your overpass query to work so I tried building it using the wizard. I confess I tend to use the QuickOSM plugin as I find the overpass query language a bit tricky :) This is the query I went with:- /* This has been generated by the overpass-turbo wizard. The original search was: “natural=water or water=lake or waterway=*” */ [out:json][...


2

I would try to filter by Geometry Type during each conversion. For example, only Lines should be forced into the Line shapefile. I think your examples are Casting Lines to Polygons and Polygons to Lines. The geometry filter should prevent this from happening. Please see the OGR_GEOMETRY example in the OGR_SQL help. http://www.gdal.org/ogr_sql.html


0

Have you tried using gdal_rasterize (http://www.gdal.org/gdal_rasterize.html) ?


1

I got OGR to open the dataset using the syntax from an example in the GeoJSON driver help: from osgeo import ogr url = "http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/MapServer/69/query?where=objectid+%3D+objectid&outfields=*&f=json" ds = ogr.Open(url) Or: ogrinfo -ro "http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/...


0

I have done my goal. At first, I made geometry in the 'MEMORY' from input geojson file(thx Luke for example). Also I converted coordinates in input file from lat/lon to the UTM(but it isn't main idea). Next I made layer from geometry and then I used gdal.RasterizeLayer(outds, [1,2,3], lyr, burn_values = [0,0,0]) to burn this polygon. But the real issue here ...


1

I didn't work through the issue with your data but my perspective is that the error comes down to a limitation of shapefile format. Topological consistency is not enforced/inherent in the shapefile format (esri's explanation here). The Mongo spatial indexing system does require topological consistency. Lacking the enforcement of consistency in the source ...


1

you want to create a layer with a single feature so you must use: features: [features[0]]


0

I was able to upload a KML file at client side using HTML5 FileReader.readAsDataURL() I followed this for uploading simple text file and restrict to kml files Following the above tutorial, use reader.result as URL to set source of a vector layer to the kml file to be uploaded. Then add the vector layer on to the map object. I hope its clear if you have ...


0

I ended up doing an INSERT and then UPDATE to use the python libs geojson and shapely to generate the geoJSON. So my code now looks like this. import geojson from models import Geofence from geoalchemy2.shape import to_shape from sqlalchemy import func from services.DatabaseSessionService import DatabaseSessionService session = DatabaseSessionService()....


0

There's also this jsfiddle I stumbled upon. I can't claim it as my own but you can sort through the options objects via event.target.options or even set the color attribute for a target event via event.target.setAttribute()


0

Reading the documentation here http://www.nanaimo.ca/crimereporting/help it seems you can construct a query url as the following and this will return the GeoJSON you are looking for http://www.nanaimo.ca/crimereporting/api/incidents.geojson


0

If you're geojson file has something like: var kcTracts = { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [ -109.3359375, 42.032974332441405 ], [ ...


2

You could use the CartoDB SQL API with CartoDB.js to call the data that you want to display depending on where the user click. In this section of the CartoDB documentation you can find more information about using theCartoDB SQL API within CartoDB.js. In this example you can find how a buffer is created everytime that a user clicks on the map and the points ...


1

1) I just don't know how to convert .geojson file to .shp. This is a one of the bases of ogr Python. If you have a geometry, it is very easy to convert it to a shapefile # geojson is GeoJson Polygon from osgeo import ogr output = "geojson.shp" driver = ogr.GetDriverByName('ESRI Shapefile') if os.path.exists(output): driver.DeleteDataSource(output) ...



Top 50 recent answers are included