Tag Info

Hot answers tagged

4

If you look at the picture below, you'll see your Shapefile is actually being displayed on the map. But it's not being projected to your map's reference system. Your Shapefile has EPSG:4326 (as you can see here) and your map has EPSG:900913. So, in your ol_simple.js file, change line: var outProj = new OpenLayers.Projection('EPSG:3857'); by: var ...


3

It looks like a new and better supported JS WKB parsing library has since appeared. https://github.com/cschwarz/wkx I've been able to use it to convert WKB directly from postgres into JS objects that can be mapped in the browser. You'll need to include https://github.com/cschwarz/wkx/blob/master/dist/wkx.js in your webpage for this to work. // Required ...


2

When you define your vector source, put the projection setting pointing to the target coordinate reference system (see the docs): new ol.layer.Vector({ title: 'added Layer', source: new ol.source.GeoJSON({ projection : 'EPSG:3857', url: 'mygeojson.json' }) }) Look at this example (using your sample data): ...


2

I have put a projection setting in your source definition and it seems to work: var vS=new ol.source.GeoJSON( ({ "object": data, projection: 'EPSG:3857' }) ); This is the result: http://jsfiddle.net/zzahmbff/3/ Perhaps this resource can help you to see different ways to load vector data: ...


2

You could use a hidden form to realize that: Button to start the Download: <input type="button" value="Download Layer Streams as Shapefile (ZIP)" onclick="shapedownload('og:streams')"> Function to be called: function shapedownload(layername) { var form = document.createElement("form"); form.method = "POST"; form.action = ...


2

You don't need a javascript query, you only need to know the number of bubbles per time and then get the change:time signal in torque layer. layer.on('change:time', function(datetime) { // update graph }) For number of bubbles you can get them from SQL API with a simple query or use this small hack I did some time ago ...


2

In the following lines you are trying to refer to a DOM element that does not exist: document.getElementById("lat").innerHTML = location.lat(); document.getElementById("lon").innerHTML = location.lng(); So in your HTML you would have to add an element like a div or a span, that you can give an id. I would use a span, so you can stay in the same line ...


2

It works in IE11. But if you access it as a file path like C:\projects\index.html then it will not load due to browser security. Not sure about exact details why. Try the sandboxed sample in IE11 http://developers.arcgis.com/javascript/sandbox/sandbox.html?sample=map_simple This worked because the page has loaded as a web URL Suggest you to setup a web ...


2

you aren't using the appropriate mixed casing for 'outFields' in your AMD FeatureLayer constructor. layer = new FeatureLayer(json, { ... outFields: ["*"], ... }); this is what is causing the problem you noticed in your AMD application downstream.


2

You would not have to define a try/catch statement. The QueryTask includes an error callback. You could just define that function and insert your code into it: queryTask.execute(query, showResults, errCallback); function errCallback(){ document.getElementById('wait').innerHTML = "Search timed out. Use a smaller search range."; }


2

I had the same issue, with a click event firing when dragging a map, when using: map.getViewport().addEventListener('click', function); I have changed this to use the ol3 event 'singleclick', the singleclick has a small delay to ensure it is not triggered by a drag or doubleclick: map.on('singleclick', function(evt){ var coordinate = evt.coordinate; ...


2

You can't use the OL2 way variable substitution, using the ${} notation. In OL3 there is the "style function" concept you can pass to the layer style property. It is executed for each feature and receives as argument the feature to be rendered and the resolution at which it is rendered. With all this you can get feature properties and use to return an ...


2

After seeking for a more broad (jQuery and AJAX related) answer here I assigned to my jsonpCallbacks unique values, like the following: //JSON request $.ajax({ url: ...


1

The problem with the above code was that map.getLayersByName("Annotations") returns a list and not a single object. So the drawn features were actually being added to the layer but my accessing of the layer was incorrect. Correct getFeatures() code: function getFeatures() { var annotation_layer_list = map.getLayersByName("Annotations") var ...


1

The problem is that you are using getMap() in the constructor of your control. But at the moment you instantiate the control, it is not yet added to the map. So, getMap() returns undefined. You can overwrite setMap(map) in your control which is called by the map when executing map.setControl(). ol3_legend.prototype.setMap = function(map) { ...


1

its not possible to get control over pan behavior in the JSAPI directly, but Ryan Mordoff wrote a really cool plugin and shared it on Github. i think most people are using it to increase the default multiplier, but you could also use it to achieve the inverse. see this thread for more info.


1

If you want to suppress popups while editing a particular layer, set disableAttributeUpdate = true in the corresponding layerInfo when instantiating the widget. This is mentioned in the API reference in the 'Constructor Details' section.


1

Note where you create the tiled varaible: tiled = new OpenLayers.Layer.WMS( "Town:roads - Tiled", "http://localhost:8080/geoserver/Town/wms", { height: '485', width: '512', layers: 'Town:roads', styles: '', srs: 'EPSG:3857', format: format, tiled: 'true', tilesOrigin : ...


1

You are almost there. In your JavaScript file ol_simple.js just change: selectControl = new OpenLayers.Control.SelectFeature(GridshpLayer,{ multiple: true}); by: selectControl = new OpenLayers.Control.SelectFeature(GridshpLayer,{ clickout: false, toggle: true, multiple: true});


1

you must replace '[HOSTNAME_AND_PATH_TO_JSAPI]dojo' with 'localhost/arcgis_js_api/library/3.12/3.12/dojo'. you are missing the dojo part!


1

This sample shows how to get visibility of layer from a dynamic layer https://developers.arcgis.com/javascript/jssamples/layers_dynamic_reorder.html In your case the code would be var dynamicLayerInfos = baseData.createDynamicLayerInfosFromLayerInfos(); var visible = []; arrayUtils.forEach(dynamicLayerInfos, function(info) { if ...


1

Knowing that your service is hosted on a local network, I am editing my answer accordingly. After your service has loaded you could use the following in the console, which would log all of the visible layers: var vislyrs = baseData.visibleLayers; for (i=0;i<vislyrs.length;i++){ console.log("Index " + vislyrs[i] + " is visible (" + ...


1

You will want to require the Units module "esri/units" and pass the units to the circle this way var circle = new Circle({ center: e.mapPoint, geodesic: domAttr.get(geodesic, "checked"), radius: 100, radiusUnit:units.MILES }); More info on units here


1

Create the vector layer: var vector = new ol.layer.Vector({ source: new ol.source.KML({ projection: 'EPSG:3857', url: 'http://path/to/your/data.kml' }) }); Add it to the OpenLayer 3 map: var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vector ], ...


1

Today I updated Firefox to version 35.0.1 and suddenly fullscreen functionality works again (IE + Chrome dont)! So as I suspected this error is related to version of every internet browser and javascript fullscreen api.


1

The only solutions currently available are hacky and may break in the future, if they decide to use something else than pos.y or refactor the code heavily. Here's another simple hacky solution which is easier to use and doesn't require updating the value every time zoom changes. It makes the zIndexOffset reflect the actual zIndex: ...


1

This is a long contested issue that doesn't seem to be near resolve.. http://code.google.com/p/gmaps-api-issues/issues/detail?id=3033 Apparently this was easy in v2: disableContinuousZoom() However; now - not so much.. Here's three options proposed by others: 1. CSS *{ -webkit-transition-property: none!important; ...


1

As commented by @blah238 both Internet Explorer versions of 7 and 8 should be supported by the ArcGIS API for JavaScript because the list of supported browsers includes: Internet Explorer 7+ From the comments it appears that the source of problems must be something other than just the Internet Explorer version being used. To progress this ...


1

I have been making my own map app using my own picture maps. Our university shifted to a new campus and I am mapping out 7 storeys (indoor), with 5 levels of zoom, from hand-drawn maps. Leaflet is able to work with custom map tiles! I have followed this guide (omarriott.com/aux/leaflet-js-non-geographical-imagery ), just that I did some trial and error ...



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