Tag Info

New answers tagged

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


0

To do this in turf, you would do the following: // assume neigborhood is a geojson polygon feature // assume pt is a geojson point feature var turf = require('turf') // < require turf if you are using it from node.js var buffered = turf.buffer(neighborhood, 10, 'miles') var isInside = turf.inside(pt, buffered) console.log(isInside) If you want to do ...


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


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


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


0

For some reason, the highlight opacity is sometimes maintained even though you call resetStyle. Explicity set fillOpacity in stateStyle, and it should work as expected. //ALL FOR STATES var stateStyle = { "color": "#3D5229", "weight": 1, "opacity": .90, "fillOpacity": .90 }; Note, you are also declaring the variable named geojson twice, ...


0

Hopefully the better I get at this the fewer questions I will answer myself. after doing some research I found the solution here apparently there was no mimetype for geojson so the server wasn't putting it out there. here are the steps. Open IIS Manager head over to the properties of the IIS Server and click MIME Types add this: extension: geojson ...


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


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


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


0

ran into some problems with the = signs. this is working for me var customStyleFunction = function(feature, resolution) { if(feature.get('WELL_CLASS')=== 'EXISTING') { strokecolor = '#020815'; } else if(feature.get('WELL_CLASS')=== 'PROPOSED') { strokecolor = '#f61212'; } else if(feature.get('WELL_CLASS')=== 'INJECTION') { strokecolor = ...


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


0

You can use GeoJSON.Net. I have no experience with it yet. But I'm planning to work with it. I'll let you know it's usefulness when I do.


0

You can use GeoJSON.Net. I'm planning to work with it. I'll let you know it's usefulness when I do.


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


0

Ok, so I had to write some code to flip the points along the y axis. I had to half of the image height, then find the difference of the y point to that middle (can be negative). I multiplied the difference by 2 and subtracted the result from the middle y value (e.g. if the SVG / underlying map tile image was 5000 pixels tall then the middle would of course ...


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


0

You can do it without having to create a million different icon images if you use CSS. Add the marker find the backgroundcolor attribute for the css and change it. Here it is: var marker = L.marker([50,-20], {icon: myIcon}).addTo(map); marker.valueOf()._icon.style.backgroundColor = 'green'


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!


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


0

You can get the two points by using: SELECT ST_geomfromtext(ST_AsText((line.a).geom)) FROM ( SELECT ST_DumpPoints(ST_AsText(the_geom)) as a from table_name) as line


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

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


0

You can activate caching with Settings -> Options, Rendering tab: [x] Use render caching where possible to speed up redraws


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



Top 50 recent answers are included