Tag Info

New answers tagged

0

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 could use this: var myStyle= {fillColor: "#ff0000"}; var BounderyshpLayer = new OpenLayers.Layer.Vector({ projection: new OpenLayers.Projection('EPSG:3826'), style: myStyle }); see: http://jsfiddle.net/expedio/2xvfbtdw/ or even use a stylemap with different style for default and select: var ...


0

Here is an working example where I get the WFS features and add them to my vector layer: OpenLayers.Request.GET({ url: 'http://demo.opengeo.org/geoserver/wfs', params: { service: 'WFS', version: '1.0.0', request: 'GetFeature', typeName: 'ne_10m_populated_places', featureNS: ...


0

You have indeed made some errors in your calculation. 156543.04 meters/pixel is a constant "based on the diameter of the Earth and the equations Microsoft used to set the zoom levels" used in two equations on the page you reference - it's not a variable. Your mistake was in substituting the map resolution your openlayers code returned for the constant. The ...


0

Bit of a workaround but you can use the getExtent method on the geometry to set the extent on the map. I presume the center of the view will then be the center of the geometry; Test = new ol.geom.Geometry(); map.getView().fitExtent(Test.getExtent, map.getSize()); var CenterOfGeom = map.getView().getCenter() If you do not want to change the view (which I ...


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


-2

I use in my project MapfishPrint to print map in pdf or image.


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

It's a ArcGIS Server and not Geoserver that delivers the WMS. ( See http://www.geo.euskadi.net/arcgis/rest/services ) so this should work: new ol.layer.Image({ source: new ol.source.ImageWMS({ url: 'http://www.geo.euskadi.net/arcgis/services/U11_AGS_WMS_Cartografia/MapServer/WMSServer?', ratio: 1, params: { ...


0

For reference: fillColor: "${getColor}", fontSize: "${fontSizer}", }, { context: { getColor : function (feature) { return feature.attributes.RATING == 'NotRated' ? 'transparent': feature.attributes.RATING == 'Low' ? 'green': feature.attributes.RATING == 'Moderate' ? 'yellow': ...


0

You can not change anything on the tiles from openstreetmap.org. But you may look out for other tile providers who use Openstreetmap data. Stamen has some real nice maps: http://maps.stamen.com/#toner/12/37.7691/-122.3510


0

Like user British steel already mentioned I would use a vector layer. Sometimes you also need a redraw of the vector layer.Have a look at http://stackoverflow.com/questions/10883142/change-z-index-of-marker-in-openlayers


0

According to the documentation there is no z-index for OpenLayers Markers, but you can definitely use one on vector layers. If you had a vector in a variable that you called someVector, then you would set it like this: someVector.setZIndex(5); Therefore I would suggest you display your data as a point vector instead of a marker.


1

You could try to set the tilesorigin and tilesize --> tileOrigin {OpenLayers.LonLat} x and y are the coordinates of the lower left corner (the “origin”) of the tile grid system new OpenLayers.Layer.WMS( "xxxxxx","url", {layers: 'xx:xxx', format: 'image/png' }, { tileOrigin: new OpenLayers.LonLat(-180, -90), tileSize: new ...


0

var vectorsource = new ol.source.Vector({features: []}); var cellLayer = new ol.layer.Vector({ name: LAYER_NAME_CELL, extent:[12568355.379388269, 3268309.784291403, 12582419.792592742, 3275590.4112355663], source: vectorsource }); // add your layer, add your features... ...


0

You could use the method "getFeaturesByAttribute" or iterate through all features: for(var i = 0; i < yourgeojsonlayer.features.length; i++) { if(yourgeojsonlayer.features[i].attributes.searchedAttribute == 'searchedValue') { selectFeatureControl.select(yourgeojsonlayer.features[i]); break; } } Ps: makes necessary to create a select ...


0

Try adding <meta http-equiv="cache-control" content="no-cache"> in the head of your html. This will help you and stops shifting the layers at a certain level. This is a common issue for the google layers.


1

Try the Geoserver print module http://docs.geoserver.org/latest/en/user/extensions/printing/index.html First you have to download the print module (be sure to choose the correct version!) then unzip the downloaded content and put the files to your /WEB-INF/lib/ folder of your Geoserver installation. Restart Geoserver and check if the config file was ...


0

Concerning the question how to add different basemaps see my other answer on Alternative to OpenLayers plugin for QGIS? But as already mentioned be aware of the terms of use


1

In Firefox you could do a rightclick on the blank tile and choose "open image in New tab" to see if it is displayed outside your app. Apart from that you could try this to see if there is an image load error: OpenLayers.Util.onImageLoadError = function() {console.log("error");};  or use the CSS-Class: .olImageLoadError { /* when OL get's a Error 404 ...


0

Have you tried to realize the scale-dependent font size with a second context-function? You can get the scale with map.getScale()


0

I will describe the way I dealed with the problem. As I mentioned before I have approximately 10000 geometries that I want to display on a map. My data are stored in a POSTGIS database and I use Geoserver (localserver) and Openlayers to display them. Also I need to interact with the data. Get attribute info for each feature and in some cased to manipulate ...


0

in your example the GetFeatureInfo-Response comes from a Geoserver: ...


1

If you use a vectorlayer you can insert an image into your popup for example like this: http://www.ereca.org.uk/olexamples/PopupPNG.htm there are existing examples with Flickr-Photos: http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/georss-flickr.html and if you want to to use a WMS-Service you could for example use your own Freemarker ...


2

You could run your script, convert the csv and then read the converted data with the OpenLayers.Text-format. But I also think that it's more straightforward to change the way the csv is read if you can't change the csv (on the server side) before you read it with OpenLayers. I just gave it a quick try and it works. I just made a copy of the file "Text.js" ...


1

Why not take a look on the OL.Format.Text code (not a big class) and see if you can extend it to use your own parser? I mean, creating a new OL.Format class that has your own logic on how your data is structured, that is, basically changing some bits on the read method.


0

You can install it in a similar way as qgis-web-client. On debian testing/ubuntu 14.04: If you presumably have cloned the repo into /home/web/: cd /home/web/ol3-mobile-viewer mkdir apache-conf Create apache-conf/ol3-mobile-viewer.conf: <VirtualHost *:80> ServerAdmin webmaster@localhost # Add an entry to your /etc/hosts file for ...


3

the unit is Pixel,see http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Feature/Vector-js.html {Number} Pixel point radius. 


0

For license issues OpenLayers does not offers a google maps layers. Here is a sample http://bl.ocks.org/elemoine/e82c7dd4b1d0ef45a9a4 on using OL3 with GMaps. You can find a similar question at: Overlaying Raster image with Google Maps in OpenLayers3


0

Definitively yes. OpenLayers3 is a viable solution for what you need. Maybe with the exception of "GIS knowledge", it is a GIS tool so probably you will need to learn some GIS concepts. Another great option is Leaflet. Initially it seems easy to start than OpenLayers but has its own limitations. You can try to create a relatively small sample using both ...


2

You could also use WMS or even preseeded tiles and just grab the single features you need to edit from wfs. http://dev.openlayers.org/releases/OpenLayers-2.10/examples/getfeature-wfs.html


0

I finally solved the problem, but I have no idea what exactly was the cause. After I added another attribute to the feature with QGIS, the problem disappeared. Now, any of the attributes that were shortened after every OpenLayers Update, remain in their original length. This means, the problem must have been caused by OpenJump, with which I created the ...


0

You could as well use the TileLayerPlugin, if you provide the tile URL yourself. For Google and Openstreetmap tiles it is: Google Google http://mt.google.com/vt/lyrs=s&x={x}&y={y}&z={z} 1 0 20 -180 -85.0 180.0 85.0 Openstreetmap OSM http://c.tile.openstreetmap.org/{z}/{x}/{y}.png 1 0 19 -180 -85.0 180.0 85.0 ...


1

With your stack, I'd suggest try to use GeoJSON as transport format but anyway, 10K are a lot of features to be handled by the client browser. I'd think on a WMS rendering for low scales and only when user is really going to do something meaningful with the data (selections probably) at larger scales then download only the vector features present on the ...


2

Just add the BaseLayer as a RasterLayer. <GDAL_WMS> <!-- Data is subject to term of use detailed at http://code.google.com/intl/nl/apis/maps/terms.html and http://www.google.com/intl/en_ALL/help/terms_maps.html --> <Service name="TMS"> <!-- ...


0

You should probably look into OpenLayers 3. You can look at the code of examples by using CTRL + U: The code does not look too complex either: http://openlayers.org/en/v3.1.1/examples/layer-swipe.html


0

For OpenLayers have a look at this example: http://tools.geofabrik.de/mc/


1

You could post the sld to a php-file which writes a sld-file on the server(considering some security aspects). Then you could point to this file: Example: 4 times the same layer, getlegendgraphic with 4 different sld's: ...


0

You could try this: https://plugins.qgis.org/plugins/TileMapScaleLevels/ But haven't tried it lately.when I used it the layer were less blurry than the layers loaded with the ol-plugin


1

well strange thing... what you could check is the featurestate... or just make a copy of the shapefile, delete your sensitiv/confidential data if neccessary ,insert two/three dummy-features and send me the file. Then I could give it a try. here the code: layer_selectable.events.register("loadend",map,function() { ...


1

You could try following: make sure that you don't use your workspace prefix in the geoserver-url http://myserver.de:80/geoserver/wfs instead of something like http://myserver.de:80/geoserver/ah_neu/wfs and add some more parameters like the schema: // version 1.1.1 layer_selectable = new OpenLayers.Layer.Vector("WFS", { strategies : [new ...


0

I've tried that code, didn't help. I've also tried with strategies: strategies: [new OpenLayers.Strategy.Fixed()], no good. The problem that might be is: i recieved excel file with csv extension and in that file, values are separated with comma. That file was downloaded from geoserver. Also csv is Comma Separated Values, and i guess i'm not supposed to ...


0

yes it does. as John Barça mentioned correct your map.addLayer section. here a working example of mine: var layer = new OpenLayers.Layer.Vector("POIs", { strategies: [new OpenLayers.Strategy.BBOX({resFactor: 1.1})], protocol: new OpenLayers.Protocol.HTTP({ url: "data/textfile.txt", ...


1

First of all I would test if the click event is fired on the mobile device (for example with a simple alert) http://jsfiddle.net/expedio/n68f7jus/ ( and make sure you are using a up to date version of OpenLayers like 2.13 ) If you are using the popup for a vector layer you could try if this example works on your mobile device (vector style not even ...


1

you can use yourVectorLayer.getSource().getFeaturesAtCoordinate(point). the result is an array, if the its length > 0 then the point in, else not.


1

These kind of operations aren't supported out of the box in ol3. (maybe in the future). But you can use a library like http://turfjs.org , in this case you'll need https://github.com/Turfjs/turf-within or https://github.com/Turfjs/turf-inside You can use ol.format.GeoJSON to convert from a ol3-geometry and geojson for turf and back.


0

Register click event ( See https://codezone4.wordpress.com/2013/04/06/getting-the-coordinates-of-a-click-in-openlayers-map/ for example). Then send the grabbed coordinates with an Ajax request to a php file ( http://www.w3schools.com/php/php_mysql_insert.asp and http://stackoverflow.com/questions/20392036/send-data-to-mysql-with-ajax-jquery-php )


0

in your Javascript there are two brackets missing at the end. perhaps that's the problem. see http://jsfiddle.net/po6m5aok/2/


1

The following approach works for me to save static maps to png files from a webpage with an embedded OpenLayers2 map (I see no reason why it should not work with OpenLayers3 though). The following code is based on the example given at http://acuriousanimal.com/blog/tag/phantomjs/. I slightly modified it to integrate the code given by user cjoudrey on ...


0

Just use Firebug or any other developer-tool to get the CSS-classname and existing rules that perhaps have to be overridden. Some parts of the Layerswitcher are styled with static images but they can also be set to user defined images by defining the image path or changing the rule that sets the image. see http://jsfiddle.net/expedio/9m3wv0qx/



Top 50 recent answers are included