Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker iconURL param potentially not working as expected? #95

Open
raulBodrea opened this issue Jul 26, 2021 · 0 comments
Open

Marker iconURL param potentially not working as expected? #95

raulBodrea opened this issue Jul 26, 2021 · 0 comments

Comments

@raulBodrea
Copy link

raulBodrea commented Jul 26, 2021

Hello!

I have the following code:

 <StaticGoogleMap
      apiKey={process.env.NEXT_PUBLIC_GMAP_API_KEY}
      size="600x480"
      maptype="satellite"
    >
      {field.features.map((feature, index) => {
        if (feature.geometry.type === 'LineString') {
          const coordinates = feature.geometry.coordinates.map(([lng, lat]) => ({ lat, lng }));

          return <Path key={index} weight={3} points={coordinates} />;
        }
        if (feature.geometry.type === 'Point') {
          const [lng, lat] = feature.geometry.coordinates;

          return (
            <Marker
              key={index}
              location={{ lat, lng }}
              anchor="center"
              size="tiny"
              iconURL="https://bit.ly/3zzfT5J" // --------------------> still showing default google pin despite having this in
              scale={0}
            />
          );
        }
      })}
    </StaticGoogleMap>

Even though the iconURL param is there and is a valid shortened image URL I'm still getting the default pin marker.
Looking at the resulting image URL I can see there's no icon query param/url field:

https://maps.googleapis.com/maps/api/staticmap?size=600x480&scale=1&format=png&maptype=satellite&key=AIzaSyBGyEm6p-yJfrl1_yvxm7gGGwcPsSzAKVk&path=weight:3%7C55.96434739875626,-2.645312103197652%7C55.96562429067907,-2.6409330619403493%7C55.96573569535842,-2.6410708639383382%7C55.964407387910754,-2.6454345938619994%7C55.965864238821375,-2.6411780432700116%7C55.964484516686525,-2.645557084527263%7C55.96594993422572,-2.641269911268018%7C55.96458735481619,-2.6457561318569427%7C55.96603562944032,-2.64134646793335%7C55.96471590209266,-2.645939867853897%7C55.966198449824894,-2.6414383359322975%7C55.9648701582618,-2.6460623585182446%7C55.96649838031999,-2.6412086659363276%7C55.96499870459881,-2.6462767171805734%7C55.966592643708815,-2.6413617792669912%7C55.9651272505099,-2.6464910758438944%7C55.96674689239686,-2.641453647264972%7C55.96523865662022,-2.646628877841858%7C55.96683258584652,-2.641545515263004%7C55.96536720173315,-2.6467973025051963%7C55.96692684842229,-2.6416067605956357%7C55.96547003751714,-2.6469351045031604%7C55.96702111076733,-2.6417598739262993%7C55.96559001225142,-2.647103529166524%7C55.96714108069372,-2.6417751852599407%7C55.96568427785414,-2.6471647744991555%7C55.96721820402202,-2.6418517419252727%7C55.96576997365707,-2.6472719538308036%7C55.9673210348859,-2.6419895439222696%7C55.96584709971815,-2.6473791331615097%7C55.967381019430675,-2.642142657252933%7C55.96594136469353,-2.6475016238267735%7C55.967423865476505,-2.642402949915245%7C55.96599278185622,-2.6476547371574375%7C55.9673210348859,-2.643336941231825%7C55.96607847697592,-2.6477159824891277%7C55.96732960411257,-2.6435972338941367%7C55.96616417190585,-2.647869095819766%7C55.967295327195565,-2.644071885219744%7C55.96626700557188,-2.6479609638187394%7C55.96726961948811,-2.6446996498750477%7C55.966361269525414,-2.6480528318167713%7C55.96723534251797,-2.6452202351996705%7C55.96644696382908,-2.648114077149403%7C55.96716678848652,-2.645740820523276%7C55.9665669355345,-2.6480987658157615%7C55.96712394215605,-2.6462767171805734%7C55.9642788396084,-2.645266169198661

At this point I'm not sure if i'm doing something wrong or the iconURL param is being ignored? Help?

Later edit: was looking at the wrong image URL. Sorry for that.

Below is a url that contains the image param (even though I'm still getting the default google marker):

https://maps.googleapis.com/maps/api/staticmap?size=600x480&scale=1&format=png&maptype=satellite&key=AIzaSyBGyEm6p-yJfrl1_yvxm7gGGwcPsSzAKVk&path=weight:3%7C55.96434739875626,-2.645312103197652%7C55.96562429067907,-2.6409330619403493%7C55.96573569535842,-2.6410708639383382%7C55.964407387910754,-2.6454345938619994%7C55.965864238821375,-2.6411780432700116%7C55.964484516686525,-2.645557084527263%7C55.96594993422572,-2.641269911268018%7C55.96458735481619,-2.6457561318569427%7C55.96603562944032,-2.64134646793335%7C55.96471590209266,-2.645939867853897%7C55.966198449824894,-2.6414383359322975%7C55.9648701582618,-2.6460623585182446%7C55.96649838031999,-2.6412086659363276%7C55.96499870459881,-2.6462767171805734%7C55.966592643708815,-2.6413617792669912%7C55.9651272505099,-2.6464910758438944%7C55.96674689239686,-2.641453647264972%7C55.96523865662022,-2.646628877841858%7C55.96683258584652,-2.641545515263004%7C55.96536720173315,-2.6467973025051963%7C55.96692684842229,-2.6416067605956357%7C55.96547003751714,-2.6469351045031604%7C55.96702111076733,-2.6417598739262993%7C55.96559001225142,-2.647103529166524%7C55.96714108069372,-2.6417751852599407%7C55.96568427785414,-2.6471647744991555%7C55.96721820402202,-2.6418517419252727%7C55.96576997365707,-2.6472719538308036%7C55.9673210348859,-2.6419895439222696%7C55.96584709971815,-2.6473791331615097%7C55.967381019430675,-2.642142657252933%7C55.96594136469353,-2.6475016238267735%7C55.967423865476505,-2.642402949915245%7C55.96599278185622,-2.6476547371574375%7C55.9673210348859,-2.643336941231825%7C55.96607847697592,-2.6477159824891277%7C55.96732960411257,-2.6435972338941367%7C55.96616417190585,-2.647869095819766%7C55.967295327195565,-2.644071885219744%7C55.96626700557188,-2.6479609638187394%7C55.96726961948811,-2.6446996498750477%7C55.966361269525414,-2.6480528318167713%7C55.96723534251797,-2.6452202351996705%7C55.96644696382908,-2.648114077149403%7C55.96716678848652,-2.645740820523276%7C55.9665669355345,-2.6480987658157615%7C55.96712394215605,-2.6462767171805734%7C55.9642788396084,-2.645266169198661&markers=size:tiny%7Canchor:center%7Cicon:https://bit.ly/3zzfT5J%7C55.96523618697987,-2.6444917917251587&markers=size:tiny%7Canchor:center%7Cicon:https://bit.ly/3zzfT5J%7C55.96539531609522,-2.6440197229385376&markers=size:tiny%7Canchor:center%7Cicon:https://bit.ly/3zzfT5J%7C55.9655124106867,-2.6436012983322144&markers=size:tiny%7Canchor:center%7Cicon:https://bit.ly/3zzfT5J%7C55.96563250733553,-2.6431721448898315&markers=size:tiny%7Canchor:center%7Cicon:https://bit.ly/3zzfT5J%7C55.96575260361165,-2.642855644226074&markers=size:tiny%7Canchor:center%7Cicon:https://bit.ly/3zzfT5J%7C55.96586369233521,-2.6426035165786743&markers=size:tiny%7Canchor:center%7Cicon:https://bit.ly/3zzfT5J%7C55.96595076165236,-2.642260193824768&markers=size:tiny%7Canchor:center%7Cicon:https://bit.ly/3zzfT5J%7C55.96604984029219,-2.6420027017593384 

Any idea why this might be?

@raulBodrea raulBodrea changed the title Marker iconURL param might be ignored? Marker iconURL param potentially not working as expected? Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant