Tag Info

Hot answers tagged

4

Please use: feature.get("prop0")


3

Give this recent talk by Paul Ramsey a view: http://blog.cleverelephant.ca/2015/03/magical-postgis.html He suggests that the PostgreSQL Full Text search make ElasticSearch unnecessary... Something to consider anyway...


3

You can do this in R using gTouches in the rgeos package. Use rgdal package to open your geojson: library(rgeos) library(rgdal) polys <- readOGR("polys.json", "OGRGeoJSON") gTouches(polys, byid=TRUE) With success, will produce an adjacency matrix in the form of: ## 0 1 2 3 ## 0 FALSE TRUE TRUE FALSE ## 1 FALSE FALSE FALSE ...


3

The most robust way to do this, is to use GDAL's ogr2ogr functionality. Since you know your datatypes, you can specify them in VRT file. The documentation has this to say about setting field types: Field (optional, from GDAL 1.7.0): One or more attribute fields may be defined with Field elements. If no Field elements are defined, the fields of the ...


2

there are two different way you can try, 1) you need to host your web server to receive the file that client uploaded. The file will be processed in your server and return the geojson file to the front-end. here is an example (with php) http://www.w3schools.com/php/php_file_upload.asp then you will get a geojson file to show in ol3. 2) the other one ...


2

If you use geojson.io, it will not mess up the property data types. Import the csv file into there, then export it out as geojson.


2

Since OGR version 1.10.0 the sqlite SQL dialect has been able to be applied to any spatial datset. Which is great, as it means that you can apply it to your GeoJSON files. Looking at the OGR GeoJSON documentation you can see that the layer name for a GeoJSON file is OGRGeoJSON which means that the SQL that selects from the GeoJSON file will translate from ...


2

Assuming you have at least PostgreSQL version 9.3, you can use a few JSON functions and operators to extract the relevant parts of the GeoJSON specification required by ST_GeomFromGeoJSON to create geometries. Try the following, where you can replace the JSON in the top part: WITH data AS (SELECT '{ "type": "FeatureCollection", "features": [ { ...


2

For questions like these, I find Tom MacWright's Mapmakers Cheat Sheet useful. In your particular case, look at the section about lines: https://github.com/tmcw/mapmakers-cheatsheet#lines. As already mentioned by @john-barça, a tiling solution is probably best; I'm personally not a fan of WMS though, I usually find mbtiles etc easier to work with.


2

GDAL/OGR supports Elasticsearch, which means that FME could support it reasonably easily. I reckon you might like to hit up the FME people on Twitter and put in a request. Try Mike Ireland @FMEEvangelist or Dale Lutz @DaleAtSafe and Don Murray @DonAtSafe. But anyway, you could use a FME script to prepare your data, then write it to a temporary file, and ...


2

Okay, got it meanwhile. There are probably different ways to do this but this one works fine. Apart from access to your Spatialite database via Python's sqlite3 module and the Spatialite extension, you'll need the geojson module (simply installable with pip). Connect to your database as usual: import sqlite3 import geojson # open a Spatialite database ...


2

There are many more sources of shapefiles than geojson, and you can easily convert shp to geojson with ogr2ogr. For example, you can download the shapefile for the "Ecoregions of the World" from here, then convert BIOME 13 (deserts) to geojson with ogr2ogr: ogr2ogr -f GeoJSON -lco -sql "SELECT * FROM wwf_terr_ecos WHERE BIOME = 13" output.json ...


1

You may want to use the qgis2leaf plugin. Here is an example (2 images below). Here is an overlook on the plugin Here is the result. On the left is the webpage,which show the points. Also see on the right that datatype is points. You can download and install the plugin, using Qgis plugin manager, or from the plugin page. For further information you ...


1

Not clear if you want all the points to be the same color, or styled according to some property in your data (a category of animal, etc.). Assuming the latter, you could set up your map slightly differently and use the pointToLayer function to return a circle marker for each point: // make an object to lookup a hex color for each category in your data var ...


1

UPDATE I found a way of handling the search using FuseSearch! .I have used it in my code and it works well.Only that when I click on the output list,it doesn't show the corresponding polygon in the map. Code var options = { position: 'topright', title: 'Parcel Search', placeholder: 'Parcen No,ID, Reg Name', maxResultLength: ...


1

If you mean you want this to be an actual clickable link, you are most of the way there. I would break up how you construct the content of the popup to be a little more explicit: var hed = $("<div>", { css: {fontSize: "16px", marginBottom: "3px"} }).appendTo(popup); var span = $("<span>", { text: "District " + properties.datazone + ": " ...


1

The result of json.loads(geojson) is a Python dictionary. You can simply use the json module (or the geojson module) and dictionaries as it was planned. geojson = "{'type': 'FeatureCollection', 'features': [{'geometry': {'type': 'Point', 'coordinates': [113.5546875, 63.704722429433225]}, 'type': 'Feature', 'properties': {'city': 'city1'}}, {'geometry': ...


1

Just a quick hack that might suit you: import itertools t = {'type': 'FeatureCollection', 'features': [{'geometry': {'type': 'Point', 'coordinates': [113.5546875, 63.704722429433225]}, 'type': 'Feature', 'properties': {'city': 'city1'}}, {'geometry': {'type': 'Point', 'coordinates': [56.953125, 41.508577297439324]}, 'type': 'Feature', 'properties': ...


1

This will not work because of the same origin policy. Use a relative url (ProxyPass) or JSONP instead. Also check out the vector-wfs example in OpenLayers 3 (but this uses a BBOX strategy). Also note that ol.source.GeoJSON will be removed with version 3.5.0 and you should use ol.source.Vector with a format instead.


1

Did you enabled geoserver JSONP settings in web.xml /geoserver/WEB-INF/web.xml contains settings like this: <context-param> <param-name>ENABLE_JSONP</param-name> <param-value>true</param-value> </context-param> You should change ENABLE_JSONP as true


1

Mapbox publishes something called Geo For Google Docs: https://github.com/mapbox/geo-googledocs/ It's another google drive script-based solution. From the repo: Geo for Google Docs is a set of tools that make it easy to use data from Google Docs Spreadsheets in TileMill, an open source map design studio. Uses Export spreadsheet data to ...


1

You might want to check out Sheetsee.js. It is a client-side library for connecting Google Spreadsheets to a website and visualizing the information in tables, maps and charts. It has a createGeoJSON function for creating geojson from your Google Spreadsheet data. You can also use one of its components, sheetsee-maps, which is built on Mapbox.js. Using ...


1

Here are a couple of Python library suggestions you could use to do the task: Get the data from the Google Spreadsheet gspread should help you getting the data from the spreadsheet Generate a GeoJSON Fiona will help you to generate the GeoJSON Publish the GeoJSON on the web geojsonio.py will help you to push the GeoJSON to geojson.io If you combine ...


1

No workaround should be needed. What you did in the first place is the right way. Take this GML as input: <?xml version="1.0" encoding="utf-8" ?> <ogr:FeatureCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ogr.maptools.org/ mixed_points.xsd" xmlns:ogr="http://ogr.maptools.org/" ...


1

Taking CSV data (test.csv) from Devdatta Tengshe's answer: Latitude,Longitude,Name, Ht 48.1,0.25,"First point", 3 49.2,1.1,"Second point", 56 47.5,0.75,"Third point", 67 In QGIS you need a *.csvt file (test.csvt) for considering data types. In this case: Real, Real, String, Integer At the next imagen it can be observed that the csv layer 'type ...


1

http://ogre.adc4gis.com/ Supports CSV and a number of other extensions.


1

Use the setStyle() method to set the style for all features, and use the eachLayer() method to set the style by feature. So, something like: var jsonLayer = L.mapbox.featureLayer(geoJson).addTo(map); // set style for all features jsonLayer.setStyle({stroke: '#555555', strokewidth: 1}); // set style by feature ...


1

This is how I would form the query you're asking about using ST_MakeEnvelope() and the && operator. You can request whatever field data you want, in addition to the geometry in GeoJSON format using ST_AsGeoJSON(). Also I recommend taking advantage of that function's ability to specify a max decimal precision value. Here I'm requesting geometries ...


1

If the output parameter is a directory instead of a file name, ogr2ogr will automatically convert all geometry types into separate shapefiles: ogr2ogr out_dir d:\incoming\nhn_09AA001_1_0.gml Unfortunately for the OP this doesn't work for KML, but it does for some of the other multiple geometry type formats like ArcInfo Coverages and GML. Posting here ...



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