Skip to main content
edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Notice removed Draw attention by Jeff Noel
Bounty Ended with erilem's answer chosen by Jeff Noel
Fixed a mistake.
Source Link
Jeff Noel
  • 227
  • 1
  • 3
  • 10

I have initialized a custom OpenLayers 3 map (used to show houses for sale in the neighborhood) with an image as the map.

Then, I then createscreate additionnal features and layers dynamically for each house (each house'sfeature's anchor is set as the middle of its image).

I've been trying to use the size property when initializing the feature, but what it does is crop the image instead of resizing it.

I think I have seen the resize function for layers somewhere in OL2, but I can't find it in OL3... would that kind of function achieve the result I want?

There's also the problem that the features are scaling way too big when zoomed out of the map, and scaling down too small when zoomed in a lot. Is there a way to specify the feature's coordinates then do some kind of invisible margins/padding around it to prevent it from going too big or too small (some kind of static size) ?

Here is the actual behavior of features (the feature seen here is the black house): Zoomed out - Next: Perfect size, the house should be way smaller when zoomed out though (as seen on the first picture).Perfect zoom - The house should've stayed bigger, instead of scaling down again in this last picture.Zoomed in too much.

I have initialized a custom OpenLayers 3 map (used to show houses for sale in the neighborhood) with an image as the map.

I then creates additionnal features and layers dynamically for each house (each house's anchor is set as the middle of its image).

I've been trying to use the size property when initializing the feature, but what it does is crop the image instead of resizing it.

I think I have seen the resize function for layers somewhere in OL2, but I can't find it in OL3... would that kind of function achieve the result I want?

There's also the problem that the features are scaling way too big when zoomed out of the map, and scaling down too small when zoomed in a lot. Is there a way to specify the feature's coordinates then do some kind of invisible margins/padding around it to prevent it from going too big or too small (some kind of static size) ?

Here is the actual behavior of features (the feature seen here is the black house): Zoomed out - Next: Perfect size, the house should be way smaller when zoomed out though (as seen on the first picture).Perfect zoom - The house should've stayed bigger, instead of scaling down again in this last picture.Zoomed in too much.

I have initialized a custom OpenLayers 3 map (used to show houses for sale in the neighborhood) with an image as the map.

Then, I create additionnal features and layers dynamically for each house (each feature's anchor is set as the middle of its image).

I've been trying to use the size property when initializing the feature, but what it does is crop the image instead of resizing it.

I think I have seen the resize function for layers somewhere in OL2, but I can't find it in OL3... would that kind of function achieve the result I want?

There's also the problem that the features are scaling way too big when zoomed out of the map, and scaling down too small when zoomed in a lot. Is there a way to specify the feature's coordinates then do some kind of invisible margins/padding around it to prevent it from going too big or too small (some kind of static size) ?

Here is the actual behavior of features (the feature seen here is the black house): Zoomed out - Next: Perfect size, the house should be way smaller when zoomed out though (as seen on the first picture).Perfect zoom - The house should've stayed bigger, instead of scaling down again in this last picture.Zoomed in too much.

Tweeted twitter.com/#!/StackGIS/status/557249567809617920
Notice added Draw attention by Jeff Noel
Bounty Started worth 50 reputation by Jeff Noel
Source Link
Jeff Noel
  • 227
  • 1
  • 3
  • 10

How to resize a feature and prevent it from scaling when zooming in OpenLayers 3

I have initialized a custom OpenLayers 3 map (used to show houses for sale in the neighborhood) with an image as the map.

I then creates additionnal features and layers dynamically for each house (each house's anchor is set as the middle of its image).

I've been trying to use the size property when initializing the feature, but what it does is crop the image instead of resizing it.

I think I have seen the resize function for layers somewhere in OL2, but I can't find it in OL3... would that kind of function achieve the result I want?

There's also the problem that the features are scaling way too big when zoomed out of the map, and scaling down too small when zoomed in a lot. Is there a way to specify the feature's coordinates then do some kind of invisible margins/padding around it to prevent it from going too big or too small (some kind of static size) ?

Here is the actual behavior of features (the feature seen here is the black house): Zoomed out - Next: Perfect size, the house should be way smaller when zoomed out though (as seen on the first picture).Perfect zoom - The house should've stayed bigger, instead of scaling down again in this last picture.Zoomed in too much.