Hot answers tagged

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


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


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


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


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.


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


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

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


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


1

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


1

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


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


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.


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


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


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


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



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