Tag Info

Hot answers tagged

7

You'll have to patch existing software in order to use such a format, but there's nothing wrong with embedding GeoJSON in other JSON formats. JSON is super extensible like this. Every object is its own namespace. If you look in the other direction, there are some applications, namely Leaflet, http://geojson.io, Fiona's command line programs, that will ...


3

Take a look at https://osm.wno-edv-service.de/boundaries/ it contains a UI to download all know administrative boundaries from OSM in a variety of formats.


3

Your question is rather broad, but from what you say, the best format would be GeoJSON. OpenLayers, Leaflet and Google Maps all read and display GeoJSON, with a trivial amount of coding required. Here is the Open Layers 3 GeoJSON example. OpenLayers 2 and 3 also have (Geo)JSON writers, which allow you to serialize OpenLayers vector objects back to JSON for ...


2

After some debugging on client side, your issue is that you define key_on="feature.properties.PCON13NM.geometry.type.Polygon", whereas it should be key_on="feature.properties.PCON13NM", Another big issue is the fact that your geometries are too big whereas you only need some geometries to display. Just for info, your GeoJSON is "only" 20Mb (your browser ...


2

You might want to look at Metro Extracts: https://mapzen.com/metro-extracts/ You can download updated (weekly) shapefiles of OSM features for many metro areas all over the globe, as .shp or GeoJSON. From there, you can drop it into QGIS or some other desktop GIS and apply the appropriate definition query, to get the bicycling layer. This should get you ...


2

There are two broad ways to do this - one is to piggyback on someone else's infrastructure. For instance, the overpass turbo api has a query already baked in to get cycle routes and this can be exported as geojson (see "load" tab). This is great for one-off queries and where you have a small amount of data, but you are reliant on the generosity of others so ...


1

GDAL supports two SQL dialects: the default OGR dialect and an alternative SQLite (Spatialite) dialect. Both dialect support selecting geometries by geometry type. Ogrinfo tool is recommended for experiments because by using it the possible troubles with writing the result out can be avoided. If output from ogrinfo is good then the reading side is OK too. ...


1

here is a rough, general approach, with a few code examples (using jQuery/javascript): Set up a couple of color styles for the markers (using circle markers here) var blueMarker = { radius: 8, fillColor: "#0000ff" }; var redMarker = { radius: 8, fillColor: "#ff0000" } Add the geojson features as L.circleMarkers, keeping track of each as a ...


1

Sounds like you want to create a layer dynamically via the REST-API as a SQL View. Another approach would be to create views in PostGis, update the store and publish the view as a layer. The first one does not clutter the database with views and your dynamic work is gathered in GeoServer. The REST-API use Basic Authentication so it is easier if you proxy ...


1

You were on the right way with onEachFeature. It's just you have to bind event click on each element. See below (tested) function whenClicked(e) { // e = event console.log(e); // You can make your ajax call declaration here //$.ajax(... } function onEachFeature(feature, layer) { //bind click layer.on({ click: whenClicked }); ...


1

To change projections with Fiona, use the pyproj module. Example with a point shapefile (you can simplify the algorithm): from pyproj import Proj, transform import fiona from fiona.crs import from_epsg shape = fiona.open('sample.shp') original = Proj(shape.crs) # EPSG:4326 in your case destination = Proj(init='EPSG:...') # your new EPSG with ...


1

Didn't try but the most obvious is where do you save your new file? Or why if you want to do 'in-place' change, you only open the shp file without changing the mode to be able to write it. Also more in general, use the with statement like in official docs because for example in your code, you do not close the file whereas with with it's automatic.



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