Hot answers tagged openlayers
34
I have seen this technique used in the past. It was explained to me by Zain Memon (from Trulia) who helped giving some input when Michal Migurski was creating TileStache. Zain went over it while explaining his Trulia demo that uses this technique at one of our older SF GeoMeetup meetings some time back. In fact, if you are in SF next week (this is my lame ...
31
This has been an annoying problem for a while, and hopefully will no longer be an issue.
3857 looks to be the current and correct code (I hope, that's what all my tile caches are in!).
Update 9/7/11 - as noted by Vadim below in comments, Esri did in fact revert back to 102100 from 3857 at Service Pack 1. Oddly, ArcGIS Server with SP1 applied returns a ...
20
It seems you can directly access the googlemap object using : layer.mapObject
(source : http://openlayers.org/blog/2010/07/10/google-maps-v3-for-openlayers/#comment-34465 )
Refer to gmap API to know how to style the layer : http://code.google.com/intl/fr/apis/maps/documentation/javascript/maptypes.html#StyledMaps
Here is a small exemple page I've done : ...
20
I have used both OpenLayers and Leaflet in my apps. There has been so much discussion on this topic in this forum and others on planet-internet. They usually fall into 2 camps - features and flexibility of OpenLayers versus simplicity of Leaflet. I would not be surprised if someone spawns an "OpenLeaf" initiative soon marrying the best of both worlds!
I ...
19
Answer to 1st question is Yes. You're using OL with a pretty much common configuration. There are tricks you can use to improve performance, I'll get to that later.
Answer to question 2 is maybe (especially with regards to fastness). You can search this site for a list of alternatives (one that springs to mind right now is Leaflet).
Answer to question 3: ...
17
Direct from the developer Dino Ravnic on a recent mailing list post:
It's not a big secret how we did it so I would be happy to share that
with you..the key is in two things:
removing from a tile all vectors which are to small to be visible
i.e. their area when calculated into pixels is less than 1px. so we
drop such a vector and instead ...
15
If you want a clusterer like redfin then check out my Leaflet.markercluster:
http://danzel.github.com/Leaflet.markercluster/example/marker-clustering-realworld.388.html
https://github.com/danzel/Leaflet.markercluster
It is fully animated etc etc :)
15
OpenLayers, as a project, started with a notion of "documentation by example". That is, the primary documentation for many aspects of the code is the almost 200 examples that we make available, with full code to back them. This is typically the first resource to go to for any documentation needs.
After that, we expanded to API documentation. This was an ...
14
Add 2 base layers to the map
Subscribe to the map's zoomend event
map.events.register(type, obj, listener);
http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.EVENT_TYPES
Check the zoom level and just switch the base map for your user
map.setBaseLayer( layerRef )
...
14
Creating and adding a vector feature to a layer:
var points = [
new OpenLayers.Geometry.Point(0, 0),
new OpenLayers.Geometry.Point(0, 100),
new OpenLayers.Geometry.Point(100, 100),
new OpenLayers.Geometry.Point(100, 0)
];
var ring = new OpenLayers.Geometry.LinearRing(points);
var polygon = new OpenLayers.Geometry.Polygon([ring]);
// create ...
13
As I described on the OSGeo list the key is in delivering data as vector JSON tiles that have pixels for subpixel geometry and generalized geometry for those features that will be actually visible on a certain level. Performance is great because this technique eliminates all unnecessary vector information and leave only those vectors that will actually have ...
13
First of all, I think you should read the Geoserver documentation on Security. http://docs.geoserver.org/stable/en/user/security you will discover it is possible to make layers accessible/inaccessible to different users or roles.
Another possible solution would be to make geoserver inaccessible from the outside world (close port 8080 on your server for IP's ...
13
The only projection for which any straight line corresponds to a great circle is the Gnomonic projection. Additionally, any straight line drawn through the center of a map in any azimuthal projection (of which the Gnomonic is one) will be a great circle. In azimuthal projections, distances can be (but are not necessarily) preserved along lines passing ...
12
In order to use scales on your map:
Set only the 'scales' option. Do not set maxResolution, minResolution, maxScale, minScale, numZoomLevels, or any other scale related property. Set it to an array of scale denominators (or scales).
Configure a unit: note that for meters, this should be 'm', for degrees, 'degrees', etc.
You can set a maxExtent. Do not set ...
12
I have had some projects with either of them. In addition to the the obvious data service/source difference there are some practical considerations.
OpenLayers advantages:
more flexible
can use almost any data source - even Google/Bing and others via API wrappers
no dependency on one map provider ToS
no usage restrictions (e.g. Google Maps for Intranet ...
12
For a simple way to do this starting with QGIS you could use QGIS Mapserver which can serve maps that you design using the normal QGIS interface. Alternatively you might want to go with GeoServer which is Java based and probably easier to install. Since both programs serve maps using open standards if you start with one and need to switch later there is no ...
12
There exists no map of the entire earth in which all (true, spherical) circles remain truly round. However, there are ways of mapping the earth in which almost all sufficiently small circles are round. These are based on conformal projections. By definition, the changes that a conformal projection makes to distances within small areas are of two types ...
12
Looks like a very similar question was recently asked on the OSGeo Open Layers forum, with the GIS Cloud developers describing their approach, which is a interesting mix of GeoJSON geometries and static pixels. They actually generate all vector tiles on the fly instead of using a pre-built cache of GeoJSON files.
Esri has implemented a similar approach, ...
12
I think you should glance at Cartaro - Geospatial CMS which consists of all the tech. you use... I haven't used it but it looks like it was developed for gisCMS.
The main features of Cartaro are: (from its site)
Spatial data storage with true geometry data types
Creation of data types from within the Drupal GUI
Integrated online editing of ...
11
The main ways to display pretty print maps from openlayers I know are:
-Geoserver with Geoext
-Mapfish with Geoext
Both solutions rely on a java part(e.g. http://geoserver.org/display/GEOS/Printing+in+GeoServer or http://www.mapfish.org/doc/print/)
-Openlayers standalone (See the official doc http://trac.openlayers.org/wiki/Printing)
More recently, a ...
11
The best thing about open source is that you can see exactly what is going on by browsing the source code. When constructing a spatial filter, a new object is initialised with the following initialize function:
72 initialize: function(options) {
73 OpenLayers.Filter.prototype.initialize.apply(this, [options]);
74 },
This can be seen in ...
11
I don't think that OpenLayers is capable of removing a feature by providing the featureID. It seems like it can only remove a features by providing a feature or an array of features:
layer.removeFeatures(featureObject);
But you could instead locate the feature first and then remove the found feature:
layer.removeFeatures(layer.getFeatureById(featureID));
...
11
Setting the z-index for each layer should help: http://www.openlayers.org/dev/examples/ordering.html
EDITED
The example I originally linked to isn't too helpful. You want to set the layerindex/z-index of the layers, not the makers within the layers (as the ordering example showed). I put together an example (based off this example) showing custom layer ...
11
Im a big fan of "preFeatureInsert"....
veclayer = new OpenLayers.Layer.Vector("vector", {
projection: map.displayProjection,
preFeatureInsert: function(feature) {
feature.geometry.transform(projWGS84,proj900913);
}
};
11
Take a look at my answer on this post.
Make sure your featureNS value is in the "Edit Workspace Page under
Namespace URI" in your GEOSERVER. Do not use something as generic as
"http://postgis.org". Use something like
"http://yourdomain/application/catalogLayer" or something unique
like that. You can make this URI up, just make it unique.
You ...
11
I saw this answer on the Openlayers mailing list a few days ago. You need to make sure you are providing a version, such as v=3.6:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&v=3.6"></script>
Then it should disappear.
--
May 17, 2012 edit:
I just saw that this problem has returned on the ...
11
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
The easiest way to set up an online map from PostGIS sources is using Geoserver. The Geoserver User Manual contains a good introduction for using PostGIS as a data source. You basically add a data store containing the connection information and after that you can publish any table containing geometries. Besides PostGIS, you can use many other data sources as ...
10
Maybe generate random points within an envelope, generate an alpha shaped polygon from the points, then remove the interior rings.
From Edelsbrunner's paper.
With the interior islands removed, these would look like amoebas to me.
10
You don't need to change the OpenLayers code. Instead, add the bounds to your map's options:
var options = {
maxExtent: new OpenLayers.Bounds(-16.08,49.06,6.76,58.74),
maxResolution: 0.00138671875,
projection: "EPSG:4326",
units: "degrees"
};
map = new OpenLayers.Map("map", options);
Only top voted, non community-wiki answers of a minimum length are eligible
