Tag Info

New answers tagged

0

In the end that's what I did - ripped some code out. Got the coordinates that I needed and then had to play around with the json job done. I got the javascript from here. http://blog.sallarp.com/geojson-google-maps-editor.html


0

You could probably convert your bounding box to a rectangle using ST_MakePolygon() and use ST_Contains() to check whether the polygons are contained within the bounding box. While returning, if you want GeoJSON, just use ST_AsGeoJson() Before doing this, if you have a big table, you might want to index your geometry column as GIST. That should speed up your ...


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. ...


0

I suggest to use the Overpass API, and select the admin_levels you want. Overpass API can export geojson. Note that not all countries of the world are included in full detail in OSM, but much better than Natural Earth or GADM provide. See http://wiki.openstreetmap.org/wiki/User:Wambacher#International_Administrative_Boundaries for details countrywise.


0

You need the boundaries of the countries, then make them in geojson format. For the data I suggest not to use OSM directly in the case you don't plan to go in bigger zoom levels, but use a global shapefile from Natural earth. For the map, you'll need Leaflet and load the file. I'd suggest to use topojson format instead of geojson. Here's the file I made some ...


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.


0

It seems you are not aware Openlayers 2 is already able to write your features to XML based formats, so I'm not sure using x2js is useful (but I don't know your use case) It can be KML, GPX, GML v2, GML v3. Those are all subsets of XML. Read the API docs for more. You can see a sample using your code to create GML (you can also look at Vector Formats ...


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 }); ...


0

If you have a simple Multipolygon such as the one below, mp= { "type": "MultiPolygon", "coordinates": [ [ [ [-99.028, 46.985], [-99.028, 50.979], [-82.062, 50.979], [-82.062, 47.002], [-99.028, 46.985] ] ], [ [ [-109.028, 36.985], [-109.028, 40.979], ...


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.


0

You do not need any reverse engineering. ogr2ogr is able to read the projection information from prj file for you. Just execute: ogr2ogr -t_srs EPSG:4326 -f geoJSON -lco COORDINATE_PRECISION=7 future.geojson your_shapefile.shp


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 ...


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 ...


0

Just go to the page for Leaflet.Control.Search You can see an example that do what you expect if I do not misunderstand. For simple need, think to go to Leaflet plugins page: some plugins may help you.


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 ...


0

You can buffer the point and save it. Then in QGIS go to Vector -> Data Management Tools -> Merge shapefiles to one. If you want geojson, then you can now convert the merged shapefiles to geojson.


0

The issue was fixed in time for QGIS 2.6 http://hub.qgis.org/issues/10711#change-57013


0

Use QGIS browser to add the GeoJSON file and it should work.


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 ...


0

If you have a well made road graph shape (with from and to nodes), you can use my qgis processing scripts at https://github.com/chourmo/QGIS-Transit-tools For batch starting points, use Shortest-times car If you want to find times from start to end, make a lines files and use Shortest-path car



Top 50 recent answers are included