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


7

You can serialize your data. To reproject the data when converting, you should pass the internal and external projection to the format class, then use that format to write out your data. var format = new OpenLayers.Format.GeoJSON({ 'internalProjection': new OpenLayers.Projection("EPSG:900913"), 'externalProjection': new ...


7

If you have to work with a Google base map, OpenLayers 2 will satisfy your needs. As stated in an OpenLayers 3 issue by @ahocevar, There will be no ol.source.GoogleMaps, unless Google change their policy and allow direct access to their map tiles. Your only chance to use Google wiht OpenLayers 3 is to make a base map without any controls with Google ...


6

As the GIS SE tag descriptions note: OpenStreetMap (OSM) is data OpenStreetMap is a collaborative project to create a free editable map of the world. The data is free, and free of legal and technical restrictions. OpenStreetMap is often shorted to OSM. OpenLayers is a client viewer OpenLayers is a JavaScript library which implements an API for ...


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


5

You need to take the ol.js file from the build directory. That means "../build/ol.js". There is a "ol-debug.js" file, too, which contains a uncompressed version of ol3.


5

That is a very hard question to answer. OpenLayers 2 has been very successful and it is easy to find examples for just about everything. OpenLayers 3 is a total rewrite and uses the Google Closure toolkit which provides a number of useful services: code compression, event handling, cross browser support, etc. OpenLayers 3 also uses webGL rendering, when it ...


5

You can use bezier Curves algorithm. Bezier algorithm convert broken line to smooth line. Use the following example: <html> <head> <script src="http://dev.openlayers.org/OpenLayers.js" type="text/javascript"></script> <title>Ya Mahdi</title> <style> html,body { height: 99%; width: 99%; } ...


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.


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

Your OpenLayers.Layer.WMS statements should look like this: basemap = new OpenLayers.Layer.WMS( "Layer Name1", "http://localhost:8080/geoserver/wms/workspacename", {layers: 'workspacename:layername'} );\ utility = new OpenLayers.Layer.WMS( "Layer Name2", "http://localhost:8080/geoserver/wms/workspacename", {layers: 'workspacename:layername', ...


4

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


4

The features of OpenLayers 3, which distinguish it from OpenLayers 2, seem to be described in a blog post entitled Hot new features in OpenLayers 3: It makes heavy use of the new capabilities of modern Web browsers (Canvas, WebGL) and opens a whole new world of possibilities like client-side vector rendering, integration of 3D data, and many more. ...


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

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

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

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

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


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


3

Here's an example of how to draw an arc by center point, radius, start angle, and end angle. Depending on the use case you have in mind this may be a viable option.


3

You could just use a different version of google-maps-api, for example http://maps.google.com/maps/api/js?v=3.5&sensor=false Example: http://jsfiddle.net/expedio/sodserrw/ The same example with your Google-API address (https://maps.googleapis.com/maps/api/js ) is also not working: http://jsfiddle.net/expedio/zx4k29k5/


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

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

This works: OpenLayers.Handler.PolygonHolePuncherHandler = (function PolygonHolePuncherHandler_module( OpenLayers, undefined ) { //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=// /** * Example: var drawControl = new OpenLayers.Control.DrawFeature( olVectorLayer, OpenLayers.Handler.PolygonHolePuncherHandler, { ...


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 found the answer! :D Below is the javascript code: <script type="text/javascript"> var map, layer; function init() { map = new OpenLayers.Map( 'map' ); layer = new OpenLayers.Layer.WMS("State", "http://localhost:8080/geoserver/topp/wms?", { ...



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