Tag Info

New answers tagged

2

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


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


0

I found the cause: I had to enable "Active Scripting" in Tool -> Internet Options -> Security Tab -> Custom Level I also had to run-as-administrator IE to be able to change those settings. I'm surprised that there wasn't an issue when running version 3.1 of ESRI's API.


0

Just read this: http://suite.opengeo.org/4.1/webapps/gxp/viewer/geocoder.html and apply it to the tools array somewhere here in GeoExplorer: https://github.com/boundlessgeo/suite/blob/master/geoexplorer/app/static/script/app/GeoExplorer/Composer.js#L58


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


0

You could listen to the postrender event which is triggered after a frame is rendered. map.on('postrender', function(){ console.log('frame rendered'); });


0

You can for example define the map as a variable and point to this variable when you create your MapPanel: var your_map=new OpenLayers.Map({allOverlays: false}); mapPanel = Ext.create('GeoExt.panel.Map', { title: 'test', border: true, region: "center", map: your_map, ...


0

For future readers, I solved this using my 2nd approach, creating a modified "fishnet" as I think it's called in GIS terms. I opted against buffers & intersects because of the "n choose k" exponential explosion of the # of intersections. More than 32 close points & I could crash a browser. For each point, I calculated the distance to every other ...


0

Two pieces of advice (which may or may not constitute an answer--haven't tested your code myself): Use Promise Objects Available within jQuery (as well as many other js libraries). Read the docs: essentially, a promise object allows you to work with variables that point to data that may still be loading asynchronously. E.g. var promiseData = ...


0

Your map is being shown in the browser before all the GeoJSON is loaded into your layers. Try wrapping your JavaScript with jQuery's ready() method. $(document).ready(function(){ <put all your code in here> });


0

The OpenLayers.Bounds class has a range of contains* methods, you can use containsLonLat in your case: var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286) .transform( new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject() ); var bounds = new OpenLayers.Bounds(5, 42, 10, 45); var isInside = bounds.containsLonLat(lonLat);


0

You can have a look at the intersection example of OpenLayers: http://dev.openlayers.org/examples/intersects.html for(var i=0; i<features.length-1; ++i) { feat1 = features[i]; for(var j=i+1; j<features.length; ++j) { feat2 = features[j]; intersects12 = feat1.geometry.intersects(feat2.geometry); if(intersects12) ...


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


0

You should see if using ESRI's satellite imagery or Mapbox's satellite imagery will work for what you need. If not, I know DigitalGlobe will sell you imagery, but I'm not sure how much it costs.


0

I haven't found out yet why exactly this does not work. but if you are interested in a "quick and dirty" workaround until you have found the error you could use this: map.setCenter(new OpenLayers.LonLat(-91, 25).transform('EPSG:4326', 'EPSG:3857'),4); map.panTo(new OpenLayers.LonLat(-90, 25).transform('EPSG:4326', 'EPSG:3857')); ...


0

I had a typo in the code "infobox.refresh(feature.proprtyies); -> infobox.refresh(feature.properties);" Correcting the typo fixed the problem. Except for the typo, the mouse event code was correct.


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.


0

Shouldn't you be able to create an OpenLayers control and display it on your map? new OpenLayers.Control.ScaleLine({}) Documentation found here. Looks like GeoExt explains a little on OpenLayers controls here also.


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


0

Just remembered about the styling options. I can set the default fillOpacity to 0 in the styleMap


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.


0

this.strategies.filter.setFilter(); should work I use a WFS-Layer for filtering: var filterStrategy = new OpenLayers.Strategy.Filter(); var layer = new OpenLayers.Layer.Vector("WFS", { strategies: [filterStrategy] }); To reset the filter I just use filterStrategy.setFilter(); and this works well. You could of course also set a filter ...


0

In OpenLayers the map holds that information so a call to map.getScale() will return the current scale denominator of the map. If no baselayer is set, returns null. All you need to do is put "1:" in front of it.


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


0

indeed Torque can send events to JS functions. maybe it's not exactly what you need (the number of bubbles accumulated) but you can set a listener on time change. Thus you can access the time and step values. Find attached an example: http://bl.ocks.org/matallo/db7bcda00e6168a061eb For the number of bubbles you can get them with the example query by ...


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


0

Yes, it's pretty easy to get the data to any DOM element you specify. If you look at the definition of events on layers, you'll see that the requested data is returned as a callback object: layer.on('featureOver', function(e, latlng, pos, data, subLayerIndex) { console.log("mouse over polygon with data: " + data); }); If you specify in your HTML ...


0

Actually I'm not sure if the SaveStrategy of OpenLayers can catch these notices. In the OGC specification is written: Individual exception messages are contained within the <ExceptionText> element. The mandatory code attribute may be used to associate an exception code with the accompanying message. The optional locator attribute may be used to ...


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


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


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


0

To add values to a datebase on the fly, break it up in three steps: 1) Catch the click and position in Javascript: https://developers.google.com/maps/documentation/javascript/examples/event-simple 2) Send the position to a server using Ajax: http://api.jquery.com/jquery.ajax/ 3) Save the values in the database using PHP: ...


0

You may want to take a look at PostGIS, a spatial database extender for PostgreSQL object-relational database. It adds support for geographic objects allowing location queries to be run in SQL. http://postgis.net/


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


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!


0

I agree with John Barça that a bit more of your javascript code would be useful or the information which errors you get in your console. What I can see so far is that you have some typos: use OpenLayers instad of Openlayers in your var custom_button and control_panel and you forgot on semicolon after control_panel.addControls([ ...


0

The answers by @kenbuja and @Derek Swingley work when you know your data set to start with or which columns will contain links. But if you are hooking up to something like a jsonRestStore you can't parse the data before hand and you it may be possible all columns could contain links. Far better to use the renderCell function which gives you access to the ...


0

as user underdark already mentioned there are also versions of the pgrouting workshop online that used OpenLayers 2.x You could for example download a slightly newer version of the workshop at https://github.com/pgRouting/workshop/releases/tag/v0.6.1 which uses OpenLayers 2.10 Here you can see a part of the demo-app: function pgrouting(store, layer, ...


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

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

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


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


0

The graphic looks like it was already added to the layer, so resetting a geometry and symbol should work. You will not be able to re-add the same graphic. Instead you should create a new instance of the graphic in the for loop. var g = new Graphic(centroid, recSymbol); recLayer.add(g);


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


0

The third parameter a QueryTask takes is a handler for error try catch is not reliable in JavaScript because of its async nature do it this way queryTask.execute(query, showResults, function(){ document.getElementById('wait').innerHTML = "Search timed out. Use a smaller search range."; }); Or you may pass in a defined function just like showResults


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



Top 50 recent answers are included