Tag Info

Hot answers tagged

19

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


12

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


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


7

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


5

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


4

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


3

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

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

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

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

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


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

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


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

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


2

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


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


1

Just off the top of my head in SQLServer, You can query the geography data type using: .ToString () See http://msdn.microsoft.com/en-us/library/bb933803.aspx for the reference info. Then you'll just have a long and lat floats which you can send to json.


1

You are referencing to 'http://www.freetrack.nl/js/OpenLayers.js' for Openlayers but the example http://dev.openlayers.org/releases/OpenLayers-2.11/examples/snapping.html is using 'http://dev.openlayers.org/releases/OpenLayers-2.11/lib/OpenLayers.js' which is different to your openlayers.js and missing all the libraries [Single File Library] that are ...


1

you can use Define Projection (Data Management) here... This tool overwrites the coordinate system information (map projection and datum) stored with a dataset. Syntax DefineProjection_management (in_dataset, coor_system) Example Code: # Name: DefineProjection.py # Description: Records the coordinate system information for the specified ...


1

Its usually* pretty easy converting. I made a script https://github.com/calvinmetcalf/esri2geo and there are others that work well too. *The exception is multi-part polygons with holes which don't convert 1-to-1 without some geoprocessing.


1

If you have the json data to parse with python, you could grab the lat/longs and use an insert cursor and the writing geometry object found here http://webhelp.esri.com/arcgiSDEsktop/9.3/index.cfm?TopicName=Writing_geometries


1

Looks similar to what is returned when doing a query Rest Query API, when doing a plugin datasource against the REST service, we ended up deserializing the JSON query response ourself using the standard JavaScriptSerializer.


1

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


1

Short version is "I don't think so". You might be able to extend ESRI's conversion classes, but frankly, it'd be a whole lot easier to make custom Json type converters with Json.NET, and attribute your geometry fields as needed. public class Animal { public string Name { get; set; } [JsonConverter(typeof(ESRIGeomConverter))] public IGeometry ...



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