Tag Info

Hot answers tagged

7

There is, yes, using a combination of row_to_json, array_to_json, array_agg and ST_AsGeoJSON. I realize, on rereading your question, that you asked for ogr2ogr approach, but seeing as your source is Postgis, I thought you might appreciate a pure Postgres/Postgis approach. I have used this approach with Google Maps, so it works well if you need to create ...


4

Use SQL abilities, in particular IN operator instead of processing each GeoJSON after your SQL query. Your $ogr2ogr -f GeoJSON out.json "PG:host=localhost dbname=xxx user=xxx password=xxx" -sql 'select id, county, wkb_geometry from cities where id=47927526' would be $ogr2ogr -f GeoJSON out.json "PG:host=localhost dbname=xxx user=xxx password=xxx" ...


3

To find out the right CRS, create a new project in QGIS with project CRS set to EPSG:3857, load Google or OpenStreetMap background from the Openlayers plugin, and look where your data is placed. If you set the Layer CRS of your data to EPSG:32749 WGS 84 / UTM zone 49S, your data will be placed in the right position (at least the same place a Google search ...


3

Perhaps DIVA-GIS may contain the shapefiles you're after with some corresponding boundaries. Select India as your country and your subject, I chose Administrative areas and received 4 shapefiles of differing levels. Choose the "IND_adm3" layer to see all the Mumbai areas within the Maharashtra district. Note: The shapefiles are outdated as Mumbai is still ...


3

The final answer is: your vector data is out of range. There were two problems with your map. The first was, that your dataset contains three coordinate for every point, while OpenLayers 2 can only handle two. To fix this, you have to include an ignoreExtraDims parameter to your format object: format: new OpenLayers.Format.GeoJSON({ ignoreExtraDims: ...


2

Since Github supports CORS, you can use jQuery's getJSON() or a micro-library like corslite to grab your geojson without altering it. Here's a working example using $.getJSON() (notice that I took out your script tag referencing your geojson file): <html> <head> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" ...


2

Your github file cannot just contain a value; it must define a variable that will be defined when the file is included as javascript. var geojsonFeature = { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, .... }; Then you can use this variable as an input to your GeoJSON layer var ...


2

You need to initialize your map object. See the source code here for an example: http://leafletjs.com/examples/quick-start-example.html Add something like this to harris.js before you call map.on. var map = L.map('map').setView([51.505, -0.09], 13); What's happening is map.on is undefined. Map itself is not defined in JavaScript, but by default DOM ...


2

This really depends on a number of factors. Are you talking about a large number of features? Do you have 100 neighborhoods and 1000 point locations, or a thousand times that number? Is your precision requirement high enough that you'll need to take Great Circle calculations into account? At less than 10 miles the error will be around 10-30 meters, ...


2

UPDATE: Your problem seems to be with your data. Here is a snippet of your file: }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 585951.8, 181704.9 ], [ 576293.9, 181299.8 ], If I'm not mistaken, those ...


2

Those input points are not in urn:ogc:def:crs:OGC:1.3:CRS84, since that is (roughly) WGS84 lon / lat, and (taking the first point): [ 383707.21875, 9211513.0 ] is not a reasonable lon / lat combination. What QGIS is (probably) doing in converting that point to -52.78125,9211513.0 is taking 383707 and wrapping it around a few times (383707.2185 - 1066 * 360 ...


1

If you are using Django (GeoDjango), look at vectorformats, which will produce GeoJSON that you can use directly in Google Maps -- we are using this in production, on a decent sized database, millions or rows and complex polygons, and it works really well. If you want to query Postgis directly, use ST_AsGeoJSON as @underdark says, but note, you need to do a ...


1

Don't code, use ST_AsGeoJSON — Return the geometry as a GeoJSON element.


1

If you edit your code this way, it works (note the ADDED line) var Markerlayer = L.geoJson(null, { pointToLayer: function(feature, latlng) { marker = L.marker(latlng, {}); marker.options['title'] = feature.properties['uname']; // ADDED return marker; }, onEachFeature: function(feature, ...


1

Not tested, but something like this should work var oldLayer = ""; // to start, declare an empty variable outside of the function scope function clickFeature(e) { var layer = e.target; layer.setIcon(layer.options.icon = icon2); // only attempt to change oldLayer icon back to original if oldLayer defined if (oldLayer) ...


1

You forgot to upload 2 files <script src="nzoutline.geojson"></script> <script src="sectors.geojson"></script> They should be in the same directory as 167finalAD.html


1

Try this change to your layer definition: var wellsLayer = new ol.layer.Vector({ source: new ol.source.GeoJSON({ projection: 'EPSG:3857', url: 'data/WELLS.geojson' }), style: customStyleFunction // "style:" is inserted and ',' is removed });


1

Another option would be to use geojson.io Just upload your geojson file and add a column, and do your edits. Once you are satisfied with your edits, you can just download the resulting geojson file Good luck!


1

There is a free REST API for this Simply POST GeoJson Data to an endpoint, and view the POI in Augmented Reality browsers(wikitude) , google earth, google maps or any GPX(track and route), KML, ARML supported app in real time. https://www.mashape.com/geokoala/geokoala/overview Just create an AppKey, and check out the code samples in ...



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