2

I have an Openlayers map displaying Acetate tiles in OSM, and I'm drawing polygon regions on a vector layer to represent the countries of the world. This works fine for the most part, however, there seems to be a problem with where the vector layer ends and it not repeating the regions. For example, here is the zoomed out view:

enter image description here

As you can see, the polygon ends/begins on the east side of Russia near Alaska. This looks okay in this view, but if you start navigating around, it starts to get confusing. As you can see in these two screenshots, parts of Europe or North America aren't showing even though I've drawn polygons over those regions. As you scroll to the left and right these regions will hide and show:

enter image description here

enter image description here

This is preventing me from being able to use OSM layers in general.

1
  • Have you resolved this? Have you considered using WMS?
    – CaptDragon
    Mar 1, 2012 at 13:57

2 Answers 2

1

Munzilla, I feel compelled to question why you would create polygons for the world's countries. It's got to be a big performance hit.

If your reason is simply to style the OSM map there are better ways.

But please tell us what you're trying to achieve to better help you. I'm interested in your end result goal if you can share that with us.

Update

Based on your comment below have you considered using google map charts or Geochart?

Geochart is pretty cool for this type of stuff. You can build a map very quickly here: http://code.google.com/apis/ajax/playground/?type=visualization#geo_chart

4
  • I'm building an application which applies different colors or shading dependent on some data. So in the screenshots above, for example, it could be that Green, Yellow, and Red are colors that represent a different range of a dataset for each country.
    – Munzilla
    Feb 28, 2012 at 19:45
  • @Munzilla: Please see my update.
    – CaptDragon
    Feb 28, 2012 at 19:57
  • Thanks CaptDragon, Yeah I thought about using them, but I've been told no google due to usage limitations with their API. Nobody wants to worry about having to pay Google for anything.
    – Munzilla
    Feb 28, 2012 at 20:36
  • 1
    Okay right. Well in that case back to your original question. can you put a demo on a publicly facing url so we can all view-source and test. It's hard to tell what you're talking about. I'm not sure if you're having issues with the 180 line or just a polygon alignment/refresh problem.
    – CaptDragon
    Feb 28, 2012 at 21:14
0

If you zoom out even further you'll see the world repeated side-by-side several times over. I suppose OpenLayers doesn't repeat the polygon vectors across all of these copies. Just the copy of the world in the centre of the view. Is that your problem?

There's some 'wrapDateLine' options (example) I don't think this would let you tell it to repeat vectors across the dateline, but...

You could tell OpenLayers not to repeat the raster basemap, so that both your coloured polygons and the basemap get chopped off at the dateline. Sort of eliminates the problem by cheating, but then if you're just going for something similar to google charts then you might also disable panning and zooming (?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.