Tag Info

Hot answers tagged

13

Every feature has a style property which is null by default because it inherits the parent vector layer's style. But you can set the style for each feature: DEMO DEMO LINK Code Example: var myFirstLineStyle = OpenLayers.Util.applyDefaults(myFirstLineStyle, OpenLayers.Feature.Vector.style['default']); myFirstLineStyle.strokeColor = "#ffffff"; ...


10

This demo takes in two coordinates and a color and will create a Geodesic line between them. DEMO LINK You can add lines by entering information into the form, OR programmatically like so: //Taj Mahal to Venice (San Marco) AddLineProgrammatically(new OpenLayers.LonLat(78.0447, 27.17461), new OpenLayers.LonLat(12.34014, 45.43338), "#006633"); //Roman ...


5

Openlayers does not feature a Geocoding API. There are several questions here related to geocoding. Some of them specifically mention openlayers and geocoding (many do so with Google).


4

If you use custom objects and properties in your GeoJSON, they are ignored when the object is read using GeoJSON format. You can clearly see this on line 115 of the GeoJSON.js source code. Since the properties are never read in the first place, it is not possible to get them in OpenLayers. There are multiple workarounds to get what you want. You could ...


4

Can you try reprojecting the shapefile (ie saving it again with a different CRS)? The one you posted is Lambert Conformal Conic, with a central meridian of 95 degrees. That pretty much matches what your image shows. I believe it is this projection (or at least this is close enough). For example, you could use OGR: ogr2ogr -t_srs EPSG:4326 -s_srs ...


4

Please check timeline plugin on GitHub. I am sure it will help you. It contains simple library to create a time related map with Open Layers. It supports cluster strategy (Open Layers.Strategy.Cluster) and time filtering. Currently it supports source data in GeoJSON or GeoRSS format.


3

Your code is working fine for me, once I do the following two: Use the full OpenLayers.js file. Use a properly configured proxy. Have you done this on your side? My Code is as follows: <script type="text/javascript"> var map; function init() { var bounds = new OpenLayers.Bounds( 145.19754, -43.423512, ...


3

As part of the WPS-GUI project that I did I created a WPS client "library" that closely models after the OpenLayers 2 interface. It uses JSONIX (http://confluence.highsource.org/display/JSNX/Jsonix) for the all OGC XML marshalling and unmarshalling. You can check it out here: https://github.com/boundlessgeo/wps-gui/blob/master/src/wpsclient.js


3

It sounds like you're quite new to web mapping, learning all of these technologies will take time (albeit a worthwhile investment). In the meantime, you could probably achieve your objectives in an afternoon using a hosted map publication platform like MangoMap. Disclaimer: I am the Founder of MangoMap.


3

you dont need to define any srs to your ArcGIS93Rest layer if your map projection and service projection is identical. var options = { projection: new OpenLayers.Projection("EPSG:900913"), displayProjection: new OpenLayers.Projection("EPSG:4326"), units: "m", }; the below code working is working as it should work. ...


3

Service parameter is mandatory for making requests to WMS services. Your URL should looks like: http://localhost:8080/geoserver/wms/filedata?request=GetCapabilities&service=WMS


3

You need to write a custom control that does that thing. Ive written a tutorial on the topic, so check it out :) http://codentonic.net/2015/04/02/custom-openlayer-control/ if you have any questions feel free to ask me


3

Polygon layers by default do not stay the same size when zooming further out because they represent an area. The only aspect that you will see for smaller polygons when zoomed out is just the outline. If you still want to represent the feature when zoomed far out one option would be to add a <PointSymbolizer> within the sld that will turn on at x ...


2

You can use Google Geocoder with OpenLayers, for an example see this post: How to use Google Maps V3 Geocode with Openlayers Disclaimer: as someone pointed out you might be in violation of their usage terms, but I'll leave that for you lawyer to figure out.


2

I am not aware of this tool, and cannot find much mention of it outside the whitepaper you linked to. I think it is a proprietary toolbar, which may or may not be available for commercial use. This type of operation is often performed using FME, which has been improved in recent years to allow the creation of 3D buildings with different shapes, styles and ...


2

It seems that this functionality was recently added to the OpenLayers 3 examples. See Tile load events for a working example. Note the loading bar right below the map indicating how much it takes to load map tiles. You can also have a look at the code of the example and notice the use of tileloadstart, tileloadend, and tileloaderror events to handle the ...


2

I would suggest that you go through the OpenGeo workshop: Introduction to the OpenGeo Suite Though this workshop deals with the Opengeo suite in particular, it has enough general advice and knowledge, to serve as a good starting point. Now let me try to answer your questions: How to publish these maps to any open webservices? The easiest way is to ...


2

At the moment I still prefer OpenLayers2. You can find a nice tutorial here: http://www.gistutor.com/openlayers/22-advanced-openlayers-tutorials/47-openlayers-wfs-t-using-a-geoserver-hosted-postgis-layer.html or even have a look at the "official" openlayers-example: http://dev.openlayers.org/releases/OpenLayers-2.13/examples/wfs-protocol-transactions.html ...


2

The easy way I use to set up styling is to load your dataset in QGIS and style it with that. Use only simple style features like colour and width and do it on a single attribute. The save that QGIS style as SLD, and copy paste that XML into GeoServer's style dialog. Trouble shoot that a bit to make sure it all came through, and you're good to go! You do ...


2

You could try to use the move callback: var my_polygonhandler = OpenLayers.Handler.RegularPolygon; var polygonControl = new OpenLayers.Control.DrawFeature(circles, my_polygonhandler, { handlerOptions: { sides: 40 } }); polygonControl.handler.callbacks.move = function (e) { var linearRing = new ...


2

So you want to create a heavy and dated looking panel based map interface? /joking/ Personally I would use Leaflet and JQuery. Both are very lightweight but have a wide range of mature plugins that can deliver what you need in a lightweight and modular way. I don't think Bootstrap will be of much benefit. Map frames are pretty much responsive by default ...


2

From the API docs (http://openlayers.org/en/v3.4.0/apidoc/ol.Map.html?unstable=true#forEachFeatureAtPixel): To stop detection, callback functions can return a truthy value. map.forEachFeatureAtPixel(pixel, function(feature) { el.innerHTML += feature.get('Proj_Client') + '<br>'; return true; });


2

You could use St_Envelope on all your airports docs ! ST_Envelope — Returns a geometry representing the bounding box of the supplied geometry.


2

Just use ST_Extent for the sub-query that selects your airports. The only trick is that in PostgreSQL you must use an alias for the subquery. Look at "a" in the following example which gives the aggregated extent of the 5 first geometries of the table. select ST_AsText(ST_Extent(a.geom)) from (select geom from tableName limit 5) as a;


2

No, you don't need separate vector files for each zoom level. Of course they could speed things a little bit up but will also require much more storage space than using a single database for a specific area. However do note that PBF files are not suited for on-demand rendering. They are designed for efficiently storing OSM data, not for running queries on ...


2

You could register the zoomend- and moveend-Event for your map like this: function bounds_update() { $("#Bounds1").text(" -> " + map.size); $("#Bounds2").text(" -> " + map.getExtent()); $("#Bounds3").text(" -> " + map.getExtent().transform(toProjection, fromProjection)); $("#Bounds4").text(" -> " ...


2

This probably isn't the type of answer that you are looking for, but I'll try to give a general answer on how one could do this. If we break down your problem into smaller tasks, then the first thing that you need to do, is to get the point that the user clicks on. There is an sample on the OpenLayers site that shows exactly how to get this done. Click ...


2

Yes, it's a projection issue. OpenLayers defaults to geographic coordinates (lat/lon) so a simple "show me the thing" with it will paint it in geographics. GeoJSON.io wants to overlay things on top of web-mercator maps, so it reprojects your data into mercator, which stretches things out at the poles, just as you are seeing.


1

It appears you did not put the two CSS files (which defines the style) into your code, and they are required when browser tries to render the map. Everything works fine after I added these two CSS files into your code (line 6 and 7). <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title>OpenLayers Basic OSM ...


1

You can use geometry.intersects(): function select() { var intersecting_feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-71.104939, 42.418935).transform( new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:3857"))); //vlayer.addFeatures([intersecting_feature]); var features = vlayer.features; ...



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