Tag Info

New answers tagged

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


0

The solution, I found, was to add the GeoJSON via the "object" property of the GeoJSON source object, like below: editLayer = new ol.layer.Vector({ source : new ol.source.GeoJSON({ style: styleFunction, defaultProjection: 'EPSG:4326', projection: "EPSG:3857", object: myGeoJSONObject }) }); I also found that I had to ...


0

INSERT INTO tablename (name, polygon) VALUES ( 'Name', ST_GeomFromGeoJSON ( '{ "type":"Polygon", "coordinates":[ [7.734375,51.835777520452], [3.8671875,48.341646172375], [7.20703125,43.580390855608], [18.6328125,43.834526782237], ...


0

First try drawing the layer without specifying a style, does it draw with the default styling ? This will help determine if the problem lies with the style definition or the data itself. What geometry type is the data ? The style example you have given will symbolise polylines and polygons only. For point data this will be by default loaded as the default ...


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

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


0

Also MyGeoData Converter allows to convert CSV and many other formats to GeoJSON and other formats on-line. It is also possible to use VRT file mentioned above...


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


1

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


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.


0

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


2

A MultiPoint, by definition, comprises several points, so geom = '{"type": "MultiPoint", "coordinates": [[100.0, 0.0], [101.0, 1.0]]}' geom = ogr.CreateGeometryFromJson(geom) # iterate through the points for i in range(0, geom.GetGeometryCount()): g = geom.GetGeometryRef(i) print "%d,%d" % (g.GetX(), g.GetY()) 100,0 101,1 as explained in Iterate ...


0

Copied from the answer on Stack Overflow here: http://stackoverflow.com/questions/25664516/leaflet-how-to-add-an-attribution-on-a-geojson-layer Quote: By default this isn't supported, but you can tack a getAttribution() method on an instance like so: http://bl.ocks.org/tmcw/05c7d1164a9e62e67e6d The example js code provided is: <script> ...


0

You can easily solve this with something like (Javascript code) var dataRows = [{ id: 1, geom: "LINESTRING(-1.131510412 52.65531, -1.13286 52.65559)" }]; features = []; dataRows.forEach(function (row) { var coords = row.geom.replace("(", "[").replace(")", "]").substring(row.geom.indexOf("("), row.geom.length); ...


0

At the moment I got it working like this. But i have the feeling it's not the best way to do it. If anybody have a better way to do it, please say it. I'm using gson 2.3.1 InputStream in = new FileInputStream(context.getExternalFilesDir(null).getPath() + "/" + jsonDatabaseFile); JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8")) ; ...


0

As far as I know there is no loadend-event included in Leaflet for GeoJSON-layers. https://github.com/Leaflet/Leaflet/issues/366 (Comment of mourner: "There is load event for all asynchronous layers (TileLayer and ImageOverlay). GeoJSON doesn't need that as it accepts already loaded JSON data, and loading logic happens externally." ) You could have a look ...


3

Theoretically you can do it with ogrinfo, SQLite SQL dialect and -sql parameter. ogrinfo -dialect sqlite -sql "delete from OGRGeoJSON where name not like 'B%'" json.json However, it does not work because for GDAL existing GeoJSON files are read-only. But try it with shapefile and you will see that it works. ogrinfo -dialect sqlite -sql "delete from json ...


0

UPDATE table_without_geoms_name SET the_geom = (SELECT a.the_geom FROM table_with_geoms as a WHERE table_without_geoms_name.parcel_id = a.parcel_id) Of course, you'd need to change the name of your tables accordingly. :-)


2

I think you need to read features using format. data=' your GeoJSON goes here '; var activationLayer = new ol.layer.Vector( { title: 'Activation Boundary', source: new ol.source.GeoJSON(), style: new ol.style.Style( { stroke: new ol.style.Stroke( { color: 'red', width: 2 }) ...


0

Found one online that might be helpful converting WKT to GeoJson and allowing preview online: http://orielo.com/projects/wkt2geojson


0

I too think that a top level 'properties' would be useful, one at the feature collection level. But the work around that I did was to make an additional feature for the feature collection, populate the properties as desired, and just set the geometry object to NULL. From my reading of the spec, this seems allowed and stays within the standard.



Top 50 recent answers are included