New answers tagged

0

I once wrote a UTFgrid function for PostGIS to be used with OSM data. It's not particularly what you're looking for, but it might give you a start. I don't know how it would work with raster though. https://github.com/nationalparkservice/places-api/blob/7f048c2addebd9772e4718a4f0df4e44e981d0a3/scripts/sql_scripts/pgs/func_o2p.sql#L338-407


1

what I needed was to get the shortest distance to the one of the vertices like the green segment in the answer of Werkuh so I'll let my code here, it works fine in case someone is looking for it: var wgs84Sphere = new ol.Sphere(6378137); var ...


1

Take a look at the ol3 API here this will get you the point of the line closest to the given coordinate. Otherwise you have to calculate the perpendicular distance. There's a few ways to accomplish that, see Wikipedia for reference. But with the function I pointed out in the API you are already halfway done. You just have to figure out the second point ...


0

If I am not mistaken... You are assigning styleFunction(feature) to a vector layer, this as a consequence means that for every feature that is loaded by the vectorSource the styleFunction(feature) is executed. You are applying the style to the features individually instead of applying a general style to the layer. It's possible to style features ...


0

As long as you asign a function to the style this is normal. Function is executed for every single feature. It's time you move the map your features get updated and so function is executed again for every single fetaure. If you dont want this attitude better asign a proper style instead of a function. var vectorSource = new ol.source.Vector({ url: ...


1

OpenLayers does check for FIDs internally and will not add a previously added feature. So make sure that you get unique FIDs from GeoServer. If you have an incorrect configuration of your data source, you may end up getting random FIDs, and then OpenLayers cannot avoid the duplication on the client.


4

I'd recommend using something like the proj4 library, which has wrappers in several languages, including JavaScript - Proj4JS. For C#, there's proj4net It has the advantage you can translate between all sorts of projections, not just OSGB. I'm not a great JS developer, but something like this should do the trick to convert OSGB back to WGS84 EDIT oops.. ...


0

If you're willing to use TileMill and MBTiles, you can do this pretty easily using CartoCSS to style the original Tiff, and output an MBTiles file. #dem { raster-opacity:1; raster-scaling:lanczos; raster-colorizer-default-mode: linear; raster-colorizer-default-color: transparent; raster-colorizer-stops: stop(0,#aaf) stop(100, #afa); } ...


6

There is a JavaScript from Convert between Latitude/Longitude & OS National Grid References which converts between easting/northings to lon/lat, which could be helpful. It is also available in GitHub


0

you van also use the getState() function if (source instanceof ol.source.Vector) { source.on("change", function () { //console.log("Vector change, state: " + source.getState()); switch (source.getState()) { case "loading": $("#ajaxSpinnerImage").show(); break; ...


0

You can configure your ol.source.ImageVector with a higher ratio value, e.g. 2 instead of the default of 1.5. This will pre-render a larger image, so you won't reach the edge of the rendered map so early. See http://openlayers.org/en/latest/apidoc/ol.source.ImageVector.html.


1

Looks like square meters based on your link. Unless that's not what you're looking for.


0

You can use the function string.split(",") in javascript it returns an array of in which you can find your coordinates as @Peter mentioned, you can also get your coordinates with cirkelFeatures[1].getGeometry().getFirstCoordinates(); in OL 3


0

You could use the zip function in Python like this (not sure if this helps though since it is Python): coordString = ...


0

My problem solved. After convert shapefile to table with postgis tools, that problem occured. I use another ways to convert shapefile to postgresql spatial table. Edit: I use arcgis. i create connection to postgresql in arcgis and then import shapefile to postgresql spatial table.


0

I haven't got any solutions for accessing KMZ files via a My Maps MSID/MID in Leaflet. However, in general, to load a KMZ file in Leaflet, you can use JSZip (along with the getBinaryContent method of JSZipUtils) to extract the KML, then Leaflet Omnivore to parse the result. JSZip will produce an object containing all the files in an archive, and you can ...


0

You can use the same method you're using to get the social info from the feature. In this code i'm assuming that if feature has "facebook" then it has the rest of social links. if (cfeatures.length == 1) { if (cfeatures[0].get('facebook')){ // Show social buttons } else { // Show only name } }


0

Looks like this tool from Mapbox can do what I need. I only need to look at how it works and do it with database, not in memory.


0

Final solution is using BBOX strategy instead of Tile var vectorSource = new ol.source.Vector({ loader: function(extent) { var url = gsWFS + '?service=WFS&version=1.1.0&request=GetFeature&typename=inforisq:' + lyrName + '&outputFormat=application/json&srsname=EPSG:3857&bbox=' + extent.join(',') + ',EPSG:3857''; ...


0

Firstly, there's no entity.properties on a constructed Cesium.Entity. If you're looking for raw data that you injected into your CZML somehow, you'll have to grab that data out before turning the CZML into real Entities. Beyond that, your main problem seems to be this line: entity.label = label; Should be a LabelGraphics instance, like this: ...


0

Yes, you have to set both baseLayerPicker and imageryProvider to false. var viewer = new Cesium.Viewer('cesiumContainer', { baseLayerPicker: false, imageryProvider: false });


3

I have solved my overlays printing problem. I getting image of overlays numbers within map. I have attached screenshot. The code is as follows. var measure_source = new ol.source.Vector({ format: new ol.format.GeoJSON() }) var getText = function(feature) { var text=measure_count[measure_dynamic_count]; measure_dynamic_count++; return text; ...


1

You can download the data of OSM in shapefile directly from geofabrik.de and adjust the data as you like using select by attribute to select the desired attribute information that you need and exclude other information that you don't need from the original data. Also, you can refer to this tutorial on how to search and download OSM from inside QGIS and do ...


0

You have a couple errors in your code, one specifically might be your issue. In the change function you call setFilters (line 79, on Chrome Developer tools) before map has been defined, on line 103. They are also in two different <script> blocks which means variable hoisting doesn't save you/ mask the problem. You need to move this code block to the ...


1

The legend does not depend on the existence of any particular layer. The part that you are missing here is a getColor function. Copying the one from the tutorial in question: function getColor(d) { return d > 1000 ? '#800026' : d > 500 ? '#BD0026' : d > 200 ? '#E31A1C' : d > 100 ? '#FC4E2A' : d ...


2

To change the vehicle type, you would use: control.getRouter().options.urlParameters.vehicle = 'foot'; However, the router does not automatically recalculate the route when you change the parameters, so to get the foot directions to show up, you will need to request it again: control.route();


0

I find ! The problem was the "rendering hardware-accelerated" parameter. If I disable this option it's work ! But How with OSM tiles all it's good and with my personal tiles, it's not good ?


1

As of one week ago, this can now be achieved with the development version of mapview: # devtools::install_github("environmentalinformatics-marburg/mapview", ref = "develop") library(mapview) library(sp) # video pt <- data.frame(x = 174.764474, y = -36.877245) coordinates(pt) <- ~ x + y proj4string(pt) <- "+init=epsg:4326" mapview(pt, popup = ...


0

You can use a custom tileLoadFunction to request images via XMLHttpRequest, instead of just setting the image src. The procedure is described in detail in this Stackoverflow answer: http://stackoverflow.com/questions/32914173/how-to-add-a-http-header-to-openlayers3-requests. Once you get the XMLHttpRequest response (in the onload handler function), you can ...


0

According to this answer at StackOverflow, the functions have been renamed in OpenLayers 3.7 and later. This is what works for me in OpenLayers 3.15.1: var extent = my_vector_layer.getSource().getExtent(); map.getView().fit(extent, map.getSize());


2

I think what she want is to able to print the overlays. Problem is the div tag of the this measure tool is dynamic and the print pdf/png tool of openlayers-3 just use div so for the print tool these measure tool's div are invisible. I am wondering what will happen if we somehow include the these dynamic measure div tags into map tag .. give a try and hope it ...


2

As ghybs suggests in the comment above, you may find the LeafletSlider plugin useful. It has some idiosyncrasies that make it unsuitable for some uses, but if all you need to do is step through consecutive years, it should suit your purposes fine. If you pass it a L.layerGroup object with the layers you want to use, it will place a JQueryUI slider control on ...


1

Check your popover conditions. You've not indicated whether this features appears on hover or click. It may be that clicking away from the feature is causing the popover to disappear. My map works fine with this functionality and the code looks something like this: var clickFeatures = function (evt) { var element = session.popup.getElement(); ...


0

layers config accepts an ol.Collection or a js array. try this var map = new ol.Map({ layers: [poly1, layers],


0

Your map object should contain MapTypeControlOptions and MapTypeIds, for example: function initMap() { var map = new google.maps.Map(document.getElementById('map'), { zoom: 5, center: {lat: 40, lng: 30}, mapTypeControl: true, mapTypeControlOptions: { mapTypeIds: [ google.maps.MapTypeId.ROADMAP, ...


1

Based on this thread it appears that this is a limitation of the print task API. The ESRI staff member there stated: Unfortunately, i don't know how of a good way to work around this problem (other than ensuring that you have fields present in the data for values you need to render by.)


2

Adding the first coordinate of first polygon to the last polygon and then force this to be polygon will result to an invalid geometry (like the one in your image) Instead of messing with the coordinates use the ol.format.wkt to get the geometry as WKT and then pass this to your java class. e.g var ol3Geom = vectorSeleccion[x].getGeometry(); var format = ...


2

This is perfectly explained in the Leaflet API reference for map options.


0

Your code contains: &CQL_FILTER=user_id=1 And I will guess that the two =s are messing up the URL. In Leaflet WMS tilelayers, any extra options which are not defined will be passed to the WMS server as parameters in each request URL, so: var layer = L.tileLayer.wms( 'http://my_wms_adress:8080/geoserver/my_location/wms', { ...


2

The Leaflet way: L.map('map', {attributionControl: false, etc...}) A simple $('.leaflet-control-attribution').hide() or non jQuery document.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';. Vladimir himself says it's OK to remove it: https://groups.google.com/d/msg/leaflet-js/fA6M7fbchOs/JTNVhqdc7JcJ, but it seems like ...


3

You can initialize your Borne geoJson layer without any data but with a styling function specified in the options: var Borne = new L.GeoJSON(false, { style: function (feature) { return {color: feature.properties.color}; } }); This style will be applied to any data you add later with addData.


2

This blog has an excellent example of how to make the window draggable and hide the arrow using dojo: https://gavinr.com/2015/04/13/arcgis-javascript-draggable-infowindow Here's the key javascript snippet: require([ 'esri/arcgis/utils', 'dojo/dnd/Moveable', 'dojo/query', 'dojo/on', 'dojo/dom-class' ], function ( arcgisUtils, ...


3

You need to close the polygon by adding the start point to the end of the list of points that you build the WKT with. So change it to: for (var z = 0; z < arreglo.length; z++) { arreglo2.push(arreglo[z][0]+" "+arreglo[z][1]); } arreglo2.push(arreglo[0][0]+" "+arreglo[0][1]); But I'm pretty sure you can use the OpenLayers WKT ...


1

Once you have your geojson back use the ol.format.GeoJSON() to parse the object and create the features. var format = new ol.format.GeoJSON(); var myGeoJsonObj = ....asign the geojson result here var myGeoJsonFeatures = format.readFeatures(myGeoJsonObj ) and then you may place your features in a vector layer using. ...


1

In the example you provided, you can see two events associated with the map object: click and pointermove. If I understood you well, you just have to switch the click event callback function with the pointermove event.


0

You can access Leaflet's internal layer id using L.stamp and set the color of the polyline by changing its .options.color property. To log the properties to the console each time the layer is edited, you will want to listen for the edit event: map.on('draw:created', function(e) { console.log('Layer created: ' + L.stamp(e.layer)); ...



Top 50 recent answers are included