Hi,

whatever i tried, creating a custom icon did not work. Even cloning the default one, when you change the image path the style is broken.

It seems wrong values are inserted in the database in the 'openlayers_styles' table, 'options' column. Modifying these values via phpmyadmin makes custom styles working normally :

NOT WORKING when creating/modifying style :

a:3:{s:4:"path";s:73:"http://xxxxx/ecv/sites/all/themes/ecv/images/autres.png";s:5:"scale";i:1;s:6:"anchor";a:2:{s:1:"x";d:0.5;s:1:"y";d:0.5;}}

WORKING after manual edit :

a:3:{s:4:"path";s:73:"http://xxxxx/ecv/sites/all/themes/ecv/images/autres.png";s:5:"scale";i:1;s:6:"anchor";a:2:{i:0;d:0.5;i:1;i:1;}}

Thanks

Comments

piactif created an issue. See original summary.

sgdev’s picture

The optionsForm function in icon.php uses a subarray of 'x' and 'y' for the anchors. To have the array generate correctly, they should be incremental values of 0 and 1. An example can be seen in the openlayers_examples_default_openlayers_styles function, where the anchor array has values of 0 and 1, not 'x' and 'y'.

Attached is a patch for review. I also edited the scale label to display "Scale" rather than "Path", since this is a typo that needs to be fixed.

sgdev’s picture

Status: Active » Needs review

Updating status.

pol’s picture

Status: Needs review » Fixed

Thanks!

roman_l’s picture

Thank you very much ron_s !

I'll apply and review the patch today.

Moreover it seems the icon url is inserted in the db as an absolute path :

a:3:{s:4:"path";s:106:"http://192.168.200.203/ecv/sites/all/modules/openlayers/modules/openlaye...";s:5:"scale";i:1;s:6:"anchor";a:2:{i:0;d:0.5;i:1;i:1;}}

Just moved my dev site to another server and the icon do not show (Failed to load resource: net::ERR_ADDRESS_UNREACHABLE)

sgdev’s picture

@Pol, this was marked as fixed, but needs to be committed. Thanks!

sgdev’s picture

@piactif, yes as far as I know, this path requires an absolute URL.

m.stenta’s picture

Status: Fixed » Needs review

Was this committed? Changing to Needs Review so it doesn't get closed automatically...

  • Pol committed 2dd9f9d on 7.x-3.x authored by ron_s
    Issue #2619100 by ron_s: Creating custom icon style does not work
    
pol’s picture

Status: Needs review » Fixed

Looks like I forgot to commit this. Anyway, I just did it now. Sorry for this, it will be included in 3.2.

  • Pol committed 77782ad on 7.x-3.x authored by ron_s
    Issue #2619100 by ron_s: Creating custom icon style does not work
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.