Tag Info

New answers tagged

1

Here is a script to turn your csv into a keyed object as suggested in the comments: function csvJSON(csv){ var lines=csv.split("\n"); var result = {}; var headers=lines[0].split(","); // start at 1 to skip the header row for(var i=1;i<lines.length;i++){ var obj = {}; var currentline=lines[i].split(","); var key = currentline[0]; ...


4

Leaflet's GeoJSON uses by default a smoothing factor which eliminates less important points. Pass {smoothFactor: 0} to L.geoJson as an option to achieve a more appropriate overlap.


1

According to the developer of Leaflet, there is some generalisation going on. So that's the cause. I'm not sure if you can turn it off or not, sorry.


0

I can see that the app in Fiddle is working well.However, the effect you mentioned is visible but I think that depends on the render speed of the layers onto the map.When zooming in the layers are all Ok. I don't think thats a problem to worry about


2

Yes, I think we could implement this in FME pretty easily. I've filed an enhancement request with our developers and we'll see what they say. If you contact our support team (http://safe.com/support) and let them know you are interested then they can add your contact details to the request. The reference number is PR#61198 Also, do please add it to the ...


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


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


0

I found admin levels with all subunits for each continent and I combined them using QGIS. Here is the geojson file if you find it useful. https://gist.github.com/cmunns/76fb72646a68202e6bde


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

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


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

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


0

you can use global variables to keep track of the current layer and popup; then reset these when you click to move to a new layer highlight: // declare these in global scope, e.g. after setting highlightStyle // name these whatever you want, case doesn't matter var CURRENTLAYER, CURRENTPOPUP; layer.on("click", function (e) { // start by clearing the ...


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


0

Based on @nickves answer I adapted my code to the following which worked for me. import json city_name = "city2" city_geojson['features'] = [city for city in city_geojson['features'] if not city['properties']['city'] == city_name]


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


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


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.


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": [ { ...


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


0

You can do it with slightly less code than ThomasG77's version: function onEachFeature(feature, layer) { //bind click layer.on('click', function (e) { // e = event console.log(e); // You can make your ajax call declaration here //$.ajax(... }); } geojson = L.geoJson(your_data, { style: style, onEachFeature: ...


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.


0

You need to refer to the geometry.coordinates of the data object (d). So, given, something looking like this, ie, referencing the features array directly from you original featureCollection for brevity (ie, equivalent to squareData.features): var features = [ { "type": "Feature", "properties": { "gid": 2196272, "acq_date": "2014\/08\/29", ...


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


0

The feature from the Feature Overlay is always returned. To filter out the filterOverlay just test if the layer parameter is defined. Like this: var stateFeature = map.forEachFeatureAtPixel(evt.pixel, function (feature, layer) { // If layer is undefined, that means it's a feature from a FeatureOverlay if (layer) { return feature; } }, null, ...


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


4

Please use: feature.get("prop0")


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


0

I propose you first modify this Google Apps Script to create a URL that parses your Google Sheets into JSON. Then use Mapbox to load the GeoJSON from the URL you created. This is an interesting application and I hope you share with the community if you get it working.


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


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

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



Top 50 recent answers are included