Tag Info

Hot answers tagged

21

I would suggest downloading and installing QGIS. You can then open the file that you link to and export the data in variety of formats. The most common format for spatial data of this type is a shapefile which is one of the files that you linked to (TM_WORLD_BORDERS_SIMPL-0.2.zip). The reason that it is a zipfile is that there are several associated files ...


14

This works with the default "Add vector layer" dialog You'll have to add the bounding box to the query manually if necessary. It's also not difficult to import GeoJSON into QGIS. For an example covering point geometries see "Tweets to QGIS".


13

According to Mike Bostock (and other contributors to the TopoJSON extension): TopoJSON is an extension of GeoJSON that encodes topology. Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called arcs. TopoJSON eliminates redundancy, offering much more compact representations of ...


11

OGR: ogr2ogr -f GeoJSON test.json "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/0/query?where=objectid+%3D+objectid&outfields=*&f=json" OGRGeoJSON That command will read the query result directly from the URL. You can also supply it with a text file containing your JSON or you can directly ...


8

I like @celenius' answer; however, another option would be to export the the World Borders Dataset to CSV using ogr2ogr. I just downloaded your preferred dataset and ran this command with ogr2ogr --note that your script should be a single string without any line breaks. I find them easiest to write in notepad with wordwrap turned on, then I copy them into my ...


8

Here's a link to Esri's doc on JSON geometry objects. From that page: The REST API supports 4 geometry types - points, polylines, polygons and envelopes. Sounds like multi-polygons are not supported. See below. You can create multi-polygons by adding additional rings. There's nothing explicit about interior v. exterior rings. I'm curious so I'm going ...


5

Stick to a single where parameter in your query string. Here's an example of a where clause hitting multiple fields: ...


5

You can also see Esri's geojson-utils on Github that "contains [javascript] utilities for converting GeoJSON to other geographic json formats and vice versa. Currently only GeoJSON to Esri JSON has been developed. Also, note that only geometries in the WGS84 coordinate system are supported."


5

ESRI JSON to GeoJSON (for OpenLayers) *Likely to be modified for Leaflet javascript //create esri JSON object var myReturn = "esriObj = "+xmlHttpGet(restCall, false); eval(myReturn); I can now work with esriObj as a JSON object i.e. esriObj.geometryType. What happens in the xmlHttpGet method? Basically I create a XMLHttpRequest and pass in ...


5

Your generated GeoJSON is valid JSON, no problem. But, it's not valid GeoJson, as you can see here: http://geojsonlint.com/ The problem seems to be that the features-array in your featurecollection contains three features, two with geometry:none and one with just geometry (which is also string-encoded). So, in short: Your OpenLayers-code seems fine, the ...


4

Leaflet and ArGIS vector layer. https://github.com/JasonSanford/leaflet-vector-layers Working demo. http://geojason.info/leaflet-vector-layers/demos/arcgis-server/ More on Leaflet and ArcGIS. Leaflet and ArcGIS Server layers i.e. AgsDynamicLayer and AgsFeatureLayer. You can get this fork which has support for ArcGIS server. ...


3

It's fairly easy with urllib2. Say you've got a gigantic url like this: http://myserver/path/to/a/thing?json1={"data":[1,2,3,4,5]}&json2={"data":[1,2,3,4,5]}&json3={"data":[1,2,3,4,5]} All you need to do is take the query (everything after the ?) and jam it in the data argument to urlopen. import urllib2 import urlparse # GET return_data = ...


3

To me it looks like the Google Maps version does not understand the holes in the same way as your original source. You need to find out how holes are expected to be defined in Google Maps. It might be that you are missing some points that needs to close each hole-polygon before going to the next. I don't know how Google Maps defines this, it's just a ...


3

There are plenty of APIs out there support JSON-P and use spatial data. Here's an example of a little youtube spatial search app I did: http://swingley.appspot.com/maps/yt The youtube API returns JSON-P. GeoNames also has several web services that return JSON-P. The pros of this are that you can do everything on the client- there's no server side ...


3

The code below works for me. using System; using System.Text; using System.Net; using Newtonsoft.Json; using System.IO; using Newtonsoft.Json.Linq; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { try { string baseUrl = ...


3

Use a Cluster Strategy in combination with a BBOX Strategy. Perhaps you should come at this from a different angle. You are not far off with your Restrict Area idea. Don't dismiss this idea too soon as reducing the usefulness of the tool. In your current approach you are loading all sites at once and then adding them to a vector layer. This means that at ...


3

you can read json file in openlayers with OpenLayers.Format.GeoJSON(). jsLayer = new OpenLayers.Layer.Vector("MyLayer", { strategies: [new OpenLayers.Strategy.Fixed()], projection: map.displayProjection, protocol: new OpenLayers.Protocol.HTTP({ url: "jsons/roads.json", format: new OpenLayers.Format.GeoJSON() ...


3

You must use a geoJSON file (The GeoJSON Format Specification) and not a simple JSON file. Your example is not a GeoJSON file (no 'geometry' tag for example) As example, GitHub announced that you can now automatically view any GeoJSON files that may be in a repository inside an interactive map driven by MapBox technology (see my example AAC.geojson) And ...


3

It's possible that the original source of the data is a format which has features not supported by ESRI shapefiles. For instance, shapefiles don't support storing attribute data anywhere other than the attribute table (the "properties" section of the GeoJSON). This means the feature.id data isn't recorded in the shapefile. With a little hacking, it would be ...


2

Take a look at CORS from w3C. Available now in most widely used browsers and removes the need for jsonp and similar work around communication protocols within a w3c standard.... http://www.html5rocks.com/en/tutorials/cors/ very handy solution to XSS issues. Enjoy. Mike


2

There is some JSON helpers i ArcObjects that you might be able to use, but I'm not sure if they are supported on the client side though: SOESupport.JsonObject


2

GeoJSON is not GML, so this won't work. vectors = new OpenLayers.Layer.GML("Internet Users", "internet_users_2005.json.fixed", { format: OpenLayers.Format.GeoJSON, Since you are reading your data from a file, you will need to read in the json into a variable. In your internet_users_2005.json.fixed file, change it so it's set as a variable: var data = ...


2

There is also the LayerTreeBuilder ux. Check out the sources from http://svn.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/ and see an example here: http://dev.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/examples/tree-builder.html


2

In theory just replace all SQL commands having geometry:: cast to geography casts (assuming that you 2008 R2 MSSQL server) Edit: looked that example code . Change Microsoft.SqlServer.Types.SqlGeometry to Microsoft.SqlServer.Types.SqlGeography OR Find SQL command which select code and force it to cast your geography objects to geometry


2

In addition to implementing BBOX filtering as per @CHenderson answer I have another suggestion: use browser sniffing and when you detect IE8 download/add only a limited number of features (you will have to experiment to find out how many IE8 can handle) and then prompt the user asking him/her to zoom in so that less features are displayed. Non-IE users will ...


2

In the hopes that it might prove useful... Define Style Make the most important feature (icon) represent the cluster. var siteStyle = new OpenLayers.Style( { graphicWidth: ICON_SIZE_WIDTH, graphicHeight: ICON_SIZE_HEIGHT, graphicXOffset: -(ICON_SIZE_WIDTH / 2), graphicYOffset: -(ICON_SIZE_HEIGHT), externalGraphic: '${icon}', }, { ...


2

ArcGIS's JSON is specific to ArcGIS server. Still you have a few options: If you can get access to ArcGIS server, publish a map service with your data as a feature service. You can then query the REST end point, and get it is JSON format. ArcGIS Online has a 30 day trial. You can do something similar there. (I am guessing here. I personally have not used ...


2

Please do not use FWTools anymore. It is outdated for some time now. Running Windows, you can get the latest GDAL binaries at http://gisinternals.com/sdk In the command line, you don't have to write \"GEOJSON\". -f GeoJSON should run fine.


2

So this python script will take a json input file as detailed above and write properly formatted geojson to the output file. run the script in terminal by doing python scriptname.py input_file.json output_file.json #! usr/bin/env python from sys import argv from os.path import exists import simplejson as json script, in_file, out_file = argv data = ...


2

Try here: Integrate GeoJSON file with openlayers.protocol.http See my answer (the accepted one). The code will solve your problem for sure. After all, try to access your URL (gj/DB2GeoJson.php) using the browser and check it here : http://json.parser.online.fr/ Check for blank spaces and strange characters (PHP is the winner in messing html things). Don't ...



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