Tag Info

New answers tagged

0

It seems that MapFish accepts well WFS as GeoJSON, never tried that though: MapFish Printing Capabilities: WFS? Since you're using Geoserver, you can try GeoExplorer, it may easily work for you: http://workshops.boundlessgeo.com/suiteintro/geoexplorer/introduction.html Check this also out: How to edit using a WFS service, without showing it on the map ...


0

Here is my own Ajax + GeoJSON + jQuery get layer data: GLOBAL VARS: var map; var unitsLayer; var fromProjection = new OpenLayers.Projection("EPSG:4326"); var toProjection = new OpenLayers.Projection("EPSG:900913"); INIT MAP function initMap() { map = new OpenLayers.Map( ... ); createUnitsLayer(); loadUnits(); } INIT LAYER ...


1

You cannot apply this particular example without understanding the JSON format: your external file "file.json" is not an .json file A correct format would be (without var states = [:) { "type": "Feature", "properties": {"party": "Republican"}, "geometry": { "type": "Polygon", "coordinates": [ [ [ -84.32281494140625, ...


0

The code looks good, but Your file.json file isn't JSON, it's Javascript, and that's not the same thing. There is no "features" object in the data, so data['features'] will fail even if the JSON was parsed. Once you fix the data and your access to it, you should get a plot.


1

ogr2ogr should do this for you. Looks like you have multiple geometry types in the dataset, not sure how that will work out. You might have to filter out by geometry type. Below not tested. See docs linked to above for inputs and flags. ogr2ogr -f "GeoJSON" "sqlexport.geojson" "MSSQL:server=localhost\sqlexpress;database=tempdb;trusted_connection=yes;" -sql ...


0

Gene's answer pointed me in the right direction. The simple answer seems to be that the data in PostGIS is in Web Mercator (EPSG 3786) and so if I want lat/long it needs to be re-projected (or de-projected...), with an SRID like EPSG 4326. call (["ogr2ogr", "-f", "GeoJSON", record[1] + ".json", 'PG:dbname=\'gis\'', "-sql", 'SELECT ...


2

OpenLayers uses the EPSG:3857 coordinate system, in meters, and not the WGS84 system, in degrees, look at OpenStreetMap Wiki: EPSG:3857 But why use subprocess and ogr2ogr? 1) you can use directly the PostGIS ST_AsGeoJSON function: import psycopg2 conn = psycopg2.connect("dbname='osm' host='localhost' user='me'") cur = conn.cursor() # srid of the layer ...


1

The correct syntax is: ogr2ogr -f GeoJSON geojson.json Areas.kml You can also use togeojson (Online Maps moving forward, from KML to GeoJSON) togeojson Areas.kml > geojson.json


1

you can do it using this SQL code SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (SELECT 'Feature' As type, ST_AsGeoJSON(lg.geom)::json As geometry, ( select row_to_json(t) from (select FIELD_1, FIELD_2, FIELD_N) t ) As properties FROM MY_TABLE_OR_VIEW As lg ) ...


0

You need to convert the coordinates in your JSON object to also be 'unprojected', just like your base image. First loop through the points object and change the coordinates in each point from [x,y] to whatever is returned by map.unproject([x,y]). Then add the JSON object to the map.


1

This should help you if you only need to do a few shapefiles http://ogre.adc4gis.com/


1

I tried your code example and it's working for me, I called it openlayers-example.html stuck it in my root folder next to the json1.json file and called it like http://localhost/openlayers-example.html. So you may need to double check that the json file is where you think it is and call it like: url: "http://localhost/json1.json" That said, I think ...


2

It really does depend on what you want the use to do with the web application. I asked a similar question here - Create interactive map with no server 1) If you want to just visually show the data then you could either load the data into a database (postgis, oracle etc) and put a geographic server (geoserver, mapserver, arcgis server) in front of that and ...


2

It's obvious here that you can't expect to get 200 MB from a server to a client in a reasonable amount of time. Your only options are to drastically simplify it (probably will resulting unusable information) or tiling it (either vector or raster tiling should work). What you do depends on what you know and what you want to achieve. Here's what I suggest, ...


0

As @BradHards already pointed out: you are messing several things together. If you want to display boundingboxes using leaflet, you can use javascript coding on the client side. Angular or node.js does not have anything in common with that. If you are unable to code on client side for whatsoever reason, you need to add some attribute to the features, ...


0

MongoDB does not accept duplicate entries. So I guess you'll have to check and remove if there are any. I was getting the same error and removing the duplicate entries solved it for me.


0

For completeness here's an actual example with ogr2ogr: ogr2ogr -f GeoJSON out.json \ "PG:host=localhost dbname=gis user=ubuntu password=toomanysecrets" \ -sql "select name,amenity,tags::hstore->'source' source,way \ from planet_osm_point where tags::hstore->'craft'='brewery'" Worked fine for me, but make sure your user has read access to the ...


2

title description marker-size marker-symbol marker-color stroke stroke-opacity stroke-width fill fill-opacity Mapbox.js uses the simplestyle spec. That's where you can find out more about defaults and accepted values. Adding a dashed line is a little more complicated, see dashArray in the leaflet documentation which will work with mapbox.js.


4

If you just want to plot the data in a desktop GIS software like QGIS, you need to make the data a "Feature Collection" as stated here: Features in GeoJSON contain a geometry object and additional properties, and a feature collection represents a list of features. Once I wrapped your GeoJSON code (above) with: {"type":"FeatureCollection", "features": ...


0

Welcome to GIS Stack Exchange! You should try Shapely: From the doc, Shapely can plot geoJson objects: import json from shapely.geometry import mapping, shape s = shape(json.loads('{"type": "Point", "coordinates": [0.0, 0.0]}')) >>> s <shapely.geometry.point.Point object at 0x...> print(json.dumps(mapping(s))) ...



Top 50 recent answers are included