این راهنما نحوه جاسازی یک نقشه تعاملی را در صفحه وب شما نشان میدهد.
ایجاد URL API جاسازی نقشهها
در زیر یک نمونه URL که API مربوط به Maps Embed را بارگذاری میکند، مشاهده میکنید:
https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS
جایگزین کنید:
- MAP_MODE با حالت نقشه شما.
- YOUR_API_KEY به همراه کلید API خود وارد کنید. برای اطلاعات بیشتر، به دریافت کلید API مراجعه کنید.
- PARAMETERS با پارامترهای مورد نیاز و اختیاری برای حالت نقشه شما.
URL را به یک iframe اضافه کنید
برای استفاده از API نقشههای جاسازیشده در صفحه وب خود، URL ساختهشده را به عنوان مقدار ویژگی src یک iframe تنظیم کنید. اندازه نقشه را با ویژگیهای height و width iframe کنترل کنید، برای مثال:
<iframe
width="450"
height="250"
frameborder="0" style="border:0"
referrerpolicy="strict-origin-when-cross-origin"
src="https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS"
allowfullscreen>
</iframe>نمونه iframe بالا از ویژگیهای اضافی زیر استفاده میکند:
- ویژگی
allowfullscreenبرای اینکه به بخشهای خاصی از نقشه اجازه دهد تمام صفحه شوند. - ویژگیهای
frameborder="0"وstyle="border:0"برای حذف حاشیه استاندارد iframe از اطراف نقشه. -
referrerpolicy="strict-origin-when-cross-origin"تضمین میکند که مرورگر دامنه وبسایت شما را به عنوان سربرگRefererبه گوگل ارسال میکند. این امر به محدودیتهای کلید API اجازه میدهد تا درخواست را تأیید کنند، در حالی که مسیرهای خاص صفحه شما را خصوصی نگه میدارند.
شما میتوانید اندازه iframe را متناسب با ساختار و طراحی وبسایت خود تغییر دهید، اما ما متوجه شدهایم که بازدیدکنندگان معمولاً با نقشههای بزرگتر راحتتر تعامل میکنند. توجه داشته باشید که نقشههای جاسازی شده در هر دو بعد، با اندازه کمتر از ۲۰۰ پیکسل پشتیبانی نمیشوند.
اطلاعات ارجاعدهنده و محدودیتهای کلید API
اگر وبسایت میزبان دارای متا تگ referrer باشد که روی no-referrer یا same-origin تنظیم شده باشد، مرورگر هدر Referer را به گوگل ارسال نمیکند. این ممکن است باعث شود محدودیت کلید API شما درخواستها را رد کند. برای اینکه این محدودیت به درستی کار کند، مانند مثال بالا، یک ویژگی referrerpolicy به iframe اضافه کنید تا صریحاً اجازه ارسال هدرهای Referer به گوگل را بدهد.
-
strict-origin-when-cross-origin(توصیه شده): فقط دامنه اصلی شما (مثلاً https://example.com/) را به گوگل ارسال میکند. این کار مسیرهای خاص صفحات شما را خصوصی نگه میدارد و در عین حال اجازه میدهد محدودیتهای کلید API عمل کنند. -
no-referrer-when-downgrade(Legacy): کل URL، شامل مسیرهای خاص صفحه و پارامترهای پرس و جو (مثلاً https://example.com/contact?user=123) را ارسال میکند.
درباره سربرگ Referrer-Policy بیشتر بدانید.
حالتهای نقشه را انتخاب کنید
میتوانید یکی از حالتهای نقشه زیر را برای استفاده در URL درخواست خود مشخص کنید:
-
place: یک پین نقشه را در یک مکان یا آدرس خاص، مانند یک مکان تاریخی، تجاری، ویژگی جغرافیایی یا شهر نمایش میدهد. -
view: نقشهای را بدون هیچ نشانگر یا مسیری برمیگرداند. -
directions: مسیر بین دو یا چند نقطه مشخص شده روی نقشه، و همچنین مسافت و زمان سفر را نمایش میدهد. -
streetview: نماهای پانورامای تعاملی از مکانهای تعیینشده را نشان میدهد. -
search: نتایج جستجو در سراسر منطقه نقشه قابل مشاهده را نشان میدهد.
حالت place
آدرس اینترنتی زیر از حالت نقشه place برای نمایش نشانگر نقشه در برج ایفل استفاده میکند:
https://www.google.com/maps/embed/v1/place
?key=YOUR_API_KEY
&q=Eiffel+Tower,Paris+Franceمیتوانید از پارامترهای زیر استفاده کنید:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
q | مورد نیاز | مکان نشانگر نقشه را تعریف میکند. | نام مکان، آدرس، کد پلاس یا شناسه مکان که با URL اسکیپ شدهاند. API نقشههای جاسازیشده از هر دو + و %20 هنگام اسکیپ کردن فاصلهها پشتیبانی میکند. برای مثال، "تالار شهر، نیویورک، نیویورک" را به City+Hall,New+York,NY یا کدهای پلاس "849VCWC8+R9" را به 849VCWC8%2BR9 تبدیل کنید. |
center | اختیاری | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
حالت view
مثال زیر از حالت view و پارامتر اختیاری maptype برای نمایش نمای ماهوارهای نقشه استفاده میکند:
https://www.google.com/maps/embed/v1/view
?key=YOUR_API_KEY
¢er=-33.8569,151.2152
&zoom=18
&maptype=satelliteمیتوانید از پارامترهای زیر استفاده کنید:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
center | مورد نیاز | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
directions
مثال زیر از حالت directions برای نمایش مسیر بین اسلو و تلمارک، نروژ، مسافت و زمان سفر بدون احتساب عوارض و بزرگراهها استفاده میکند.
https://www.google.com/maps/embed/v1/directions
?key=YOUR_API_KEY
&origin=Oslo+Norway
&destination=Telemark+Norway
&avoid=tolls|highwaysمیتوانید از پارامترهای زیر استفاده کنید:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
origin | مورد نیاز | نقطه شروع نمایش مسیرها را تعریف میکند. | نام مکان، آدرس، کد پلاس، مختصات طول/عرض جغرافیایی یا شناسه مکان که با URL اسکیپ شدهاند. API نقشههای جاسازیشده از هر دو + و %20 هنگام اسکیپ کردن فاصلهها پشتیبانی میکند. برای مثال، "City Hall, New York, NY" را به City+Hall,New+York,NY یا کدهای پلاس "849VCWC8+R9" را به 849VCWC8%2BR9 تبدیل کنید. |
destination | مورد نیاز | نقطه پایانی مسیرها را تعریف میکند. | نام مکان، آدرس، کد پلاس، مختصات طول/عرض جغرافیایی یا شناسه مکان که با URL اسکیپ شدهاند. API نقشههای جاسازیشده از هر دو + و %20 هنگام اسکیپ کردن فاصلهها پشتیبانی میکند. برای مثال، "City Hall, New York, NY" را به City+Hall,New+York,NY یا کدهای پلاس "849VCWC8+R9" را به 849VCWC8%2BR9 تبدیل کنید. |
waypoints | اختیاری | یک یا چند مکان واسطه را برای مسیریابی بین مبدا و مقصد مشخص میکند. | نام مکان، آدرس یا شناسه مکان . با استفاده از کاراکتر پایپ (|) برای جدا کردن مکانها، میتوان چندین نقطه مسیر مشخص کرد (مثلاً Berlin,Germany|Paris,France ). میتوانید تا 20 نقطه مسیر مشخص کنید. |
mode | اختیاری | روش سفر را تعریف میکند. اگر هیچ حالتی مشخص نشده باشد، API نقشههای جاسازیشده یک یا چند حالت مرتبطتر را برای مسیر مشخصشده نشان میدهد. | driving ، walking (که مسیرهای عابر پیاده و پیادهروها را در صورت وجود ترجیح میدهد)، bicycling (که مسیرهایی با استفاده از مسیرهای دوچرخهسواری و خیابانهای ترجیحی را در صورت وجود ترجیح میدهد)، transit یا flying . |
avoid | اختیاری | ویژگیهایی را که باید در مسیرها از آنها اجتناب شود، مشخص میکند. توجه داشته باشید که این امر مسیرهایی را که شامل ویژگی(های) محدود شده هستند، مسدود نمیکند؛ بلکه نتیجه را به سمت مسیرهای مطلوبتر متمایل میکند. | tolls ، ferries و/یا highways . مقادیر چندگانه را با کاراکتر پایپ از هم جدا کنید (مثلاً avoid=tolls|highways ). |
units | اختیاری | روش اندازهگیری، متریک یا امپریال، را هنگام نمایش فواصل در نتایج مشخص میکند. اگر units مشخص نشده باشند، کشور origin پرسوجو واحدهای مورد استفاده را تعیین میکند. | metric یا imperial |
center | اختیاری | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
حالت streetview
API نقشههای جاسازیشده به شما امکان میدهد تصاویر نمای خیابان را به صورت پانوراماهای تعاملی از مکانهای تعیینشده در سراسر منطقه تحت پوشش آن نمایش دهید. تصاویر کروی (Photosphere) که توسط کاربران ارائه میشوند و مجموعههای ویژه نمای خیابان نیز در دسترس هستند.
هر پانورامای نمای خیابان، یک نمای کامل ۳۶۰ درجه از یک مکان واحد ارائه میدهد. تصاویر شامل ۳۶۰ درجه نمای افقی (یک پوشش کامل) و ۱۸۰ درجه نمای عمودی (از مستقیم به بالا تا مستقیم به پایین) هستند. حالت streetview نمایشگری را ارائه میدهد که پانورامای حاصل را به صورت یک کره با یک دوربین در مرکز آن نمایش میدهد. میتوانید دوربین را برای کنترل زوم و جهت دوربین دستکاری کنید.
پانورامای حالت streetview زیر را ببینید:
https://www.google.com/maps/embed/v1/streetview
?key=YOUR_API_KEY
&location=46.414382,10.013988
&heading=210
&pitch=10
&fov=35یکی از پارامترهای URL زیر الزامی است:
تابع
locationیک عرض جغرافیایی و یک طول جغرافیایی را به عنوان مقادیر جدا شده با کاما میپذیرد (46.414382,10.013988). این API، پانورامای عکاسی شده در نزدیکترین فاصله به این مکان را نمایش میدهد. از آنجا که تصاویر Street View به صورت دورهای بهروزرسانی میشوند و عکسها ممکن است هر بار از موقعیتهای کمی متفاوت گرفته شوند، این امکان وجود دارد که مکان شما هنگام بهروزرسانی تصاویر، پانورامای متفاوتی را نمایش دهد.panoیک شناسه خاص پانوراما است. اگر یکpanoمشخص کنید، میتوانید یکlocationنیز مشخص کنید. اینlocationفقط در صورتی استفاده میشود که API نتواند شناسه پانوراما را پیدا کند.
پارامترهای URL زیر اختیاری هستند:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
heading | اختیاری | جهت قطبنمای دوربین را بر حسب درجه در جهت عقربههای ساعت از شمال نشان میدهد. | مقدار بر حسب درجه از ۱۸۰- تا ۳۶۰ درجه |
pitch | اختیاری | زاویه دوربین را، به سمت بالا یا پایین، مشخص میکند. مقادیر مثبت، دوربین را به سمت بالا و مقادیر منفی، دوربین را به سمت پایین زاویه میدهند. شیب پیشفرض ۰ درجه بر اساس موقعیت دوربین هنگام گرفتن تصویر تنظیم میشود. به همین دلیل، شیب ۰ درجه اغلب، اما نه همیشه، افقی است. به عنوان مثال، تصویری که روی تپه گرفته شده است، احتمالاً شیب پیشفرضی را نشان میدهد که افقی نیست. | مقدار بر حسب درجه از ۹۰- تا ۹۰ درجه |
fov | اختیاری | میدان دید افقی تصویر را تعیین میکند. به طور پیشفرض روی ۹۰ درجه تنظیم شده است. هنگام کار با یک دریچه دید با اندازه ثابت، میدان دید را میتوان سطح زوم در نظر گرفت، که اعداد کوچکتر نشان دهنده سطح زوم بالاتر هستند. | مقدار بر حسب درجه، با محدوده ۱۰ تا ۱۰۰ درجه |
center | اختیاری | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
حالت search
حالت Search نتایج جستجو را در سراسر ناحیه قابل مشاهده نقشه نمایش میدهد. توصیه میشود که یک مکان برای جستجو تعریف شود، یا با گنجاندن یک مکان در عبارت جستجو ( record+stores+in+Seattle ) یا با گنجاندن پارامتر center و zoom برای محدود کردن جستجو.
https://www.google.com/maps/embed/v1/search
?key=YOUR_API_KEY
&q=record+stores+in+Seattleمیتوانید از پارامترهای زیر استفاده کنید:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
q | مورد نیاز | عبارت جستجو را تعریف میکند. | میتواند شامل یک محدودیت جغرافیایی باشد، مانند in+Seattle یا near+98033 . |
center | اختیاری | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
پارامترهای شناسه مکان
API نقشههای جاسازیشده (Maps Embed API) از استفاده از شناسههای مکان به جای ارائه نام یا آدرس مکان پشتیبانی میکند. شناسههای مکان روشی پایدار برای شناسایی منحصر به فرد یک مکان هستند. برای اطلاعات بیشتر، به مستندات Places API (جدید) مراجعه کنید.
API نقشههای جاسازیشده، شناسههای مکان را برای پارامترهای URL زیر میپذیرد:
-
q -
origin -
destination -
waypoints
برای استفاده از شناسه مکان، ابتدا باید پیشوند place_id: اضافه کنید. کد زیر تالار شهر نیویورک را به عنوان مبدا درخواست مسیر مشخص میکند: origin=place_id:ChIJs--MqP1YwokRBwAhjXWIHn8 .
radiusشعاعی را که بر حسب متر مشخص شده است، برای جستجوی پانوراما با محوریت طول و عرض جغرافیایی مشخص شده تعیین میکند. مقادیر معتبر، اعداد صحیح غیر منفی هستند. مقدار پیشفرض ۵۰ است.sourceجستجوهای نمای خیابان را به منابع انتخاب شده محدود میکند. مقادیر معتبر عبارتند از:-
defaultاز منابع پیشفرض برای نمای خیابان استفاده میکند؛ جستجوها محدود به منابع خاصی نیستند. -
outdoorجستجوها را به مجموعههای فضای باز محدود میکند. مجموعههای فضای بسته در نتایج جستجو لحاظ نمیشوند. توجه داشته باشید که ممکن است تصاویر پانورامای فضای باز برای مکان مشخص شده وجود نداشته باشند. همچنین توجه داشته باشید که جستجو فقط پانوراماهایی را برمیگرداند که در آنها بتوان تشخیص داد که آیا آنها در فضای بسته هستند یا در فضای باز. به عنوان مثال، PhotoSphereها برگردانده نمیشوند زیرا مشخص نیست که آیا آنها در فضای باز هستند یا در فضای بسته.
-
این راهنما نحوه جاسازی یک نقشه تعاملی را در صفحه وب شما نشان میدهد.
ایجاد URL API جاسازی نقشهها
در زیر یک نمونه URL که API مربوط به Maps Embed را بارگذاری میکند، مشاهده میکنید:
https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS
جایگزین کنید:
- MAP_MODE با حالت نقشه شما.
- YOUR_API_KEY به همراه کلید API خود وارد کنید. برای اطلاعات بیشتر، به دریافت کلید API مراجعه کنید.
- PARAMETERS با پارامترهای مورد نیاز و اختیاری برای حالت نقشه شما.
URL را به یک iframe اضافه کنید
برای استفاده از API نقشههای جاسازیشده در صفحه وب خود، URL ساختهشده را به عنوان مقدار ویژگی src یک iframe تنظیم کنید. اندازه نقشه را با ویژگیهای height و width iframe کنترل کنید، برای مثال:
<iframe
width="450"
height="250"
frameborder="0" style="border:0"
referrerpolicy="strict-origin-when-cross-origin"
src="https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS"
allowfullscreen>
</iframe>نمونه iframe بالا از ویژگیهای اضافی زیر استفاده میکند:
- ویژگی
allowfullscreenبرای اینکه به بخشهای خاصی از نقشه اجازه دهد تمام صفحه شوند. - ویژگیهای
frameborder="0"وstyle="border:0"برای حذف حاشیه استاندارد iframe از اطراف نقشه. -
referrerpolicy="strict-origin-when-cross-origin"تضمین میکند که مرورگر دامنه وبسایت شما را به عنوان سربرگRefererبه گوگل ارسال میکند. این امر به محدودیتهای کلید API اجازه میدهد تا درخواست را تأیید کنند، در حالی که مسیرهای خاص صفحه شما را خصوصی نگه میدارند.
شما میتوانید اندازه iframe را متناسب با ساختار و طراحی وبسایت خود تغییر دهید، اما ما متوجه شدهایم که بازدیدکنندگان معمولاً با نقشههای بزرگتر راحتتر تعامل میکنند. توجه داشته باشید که نقشههای جاسازی شده در هر دو بعد، با اندازه کمتر از ۲۰۰ پیکسل پشتیبانی نمیشوند.
اطلاعات ارجاعدهنده و محدودیتهای کلید API
اگر وبسایت میزبان دارای متا تگ referrer باشد که روی no-referrer یا same-origin تنظیم شده باشد، مرورگر هدر Referer را به گوگل ارسال نمیکند. این ممکن است باعث شود محدودیت کلید API شما درخواستها را رد کند. برای اینکه این محدودیت به درستی کار کند، مانند مثال بالا، یک ویژگی referrerpolicy به iframe اضافه کنید تا صریحاً اجازه ارسال هدرهای Referer به گوگل را بدهد.
-
strict-origin-when-cross-origin(توصیه شده): فقط دامنه اصلی شما (مثلاً https://example.com/) را به گوگل ارسال میکند. این کار مسیرهای خاص صفحات شما را خصوصی نگه میدارد و در عین حال اجازه میدهد محدودیتهای کلید API عمل کنند. -
no-referrer-when-downgrade(Legacy): کل URL، شامل مسیرهای خاص صفحه و پارامترهای پرس و جو (مثلاً https://example.com/contact?user=123) را ارسال میکند.
درباره سربرگ Referrer-Policy بیشتر بدانید.
حالتهای نقشه را انتخاب کنید
میتوانید یکی از حالتهای نقشه زیر را برای استفاده در URL درخواست خود مشخص کنید:
-
place: یک پین نقشه را در یک مکان یا آدرس خاص، مانند یک مکان تاریخی، تجاری، ویژگی جغرافیایی یا شهر نمایش میدهد. -
view: نقشهای را بدون هیچ نشانگر یا مسیری برمیگرداند. -
directions: مسیر بین دو یا چند نقطه مشخص شده روی نقشه، و همچنین مسافت و زمان سفر را نمایش میدهد. -
streetview: نماهای پانورامای تعاملی از مکانهای تعیینشده را نشان میدهد. -
search: نتایج جستجو در سراسر منطقه نقشه قابل مشاهده را نشان میدهد.
حالت place
آدرس اینترنتی زیر از حالت نقشه place برای نمایش نشانگر نقشه در برج ایفل استفاده میکند:
https://www.google.com/maps/embed/v1/place
?key=YOUR_API_KEY
&q=Eiffel+Tower,Paris+Franceمیتوانید از پارامترهای زیر استفاده کنید:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
q | مورد نیاز | مکان نشانگر نقشه را تعریف میکند. | نام مکان، آدرس، کد پلاس یا شناسه مکان که با URL اسکیپ شدهاند. API نقشههای جاسازیشده از هر دو + و %20 هنگام اسکیپ کردن فاصلهها پشتیبانی میکند. برای مثال، "تالار شهر، نیویورک، نیویورک" را به City+Hall,New+York,NY یا کدهای پلاس "849VCWC8+R9" را به 849VCWC8%2BR9 تبدیل کنید. |
center | اختیاری | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
حالت view
مثال زیر از حالت view و پارامتر اختیاری maptype برای نمایش نمای ماهوارهای نقشه استفاده میکند:
https://www.google.com/maps/embed/v1/view
?key=YOUR_API_KEY
¢er=-33.8569,151.2152
&zoom=18
&maptype=satelliteمیتوانید از پارامترهای زیر استفاده کنید:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
center | مورد نیاز | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
directions
مثال زیر از حالت directions برای نمایش مسیر بین اسلو و تلمارک، نروژ، مسافت و زمان سفر بدون احتساب عوارض و بزرگراهها استفاده میکند.
https://www.google.com/maps/embed/v1/directions
?key=YOUR_API_KEY
&origin=Oslo+Norway
&destination=Telemark+Norway
&avoid=tolls|highwaysمیتوانید از پارامترهای زیر استفاده کنید:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
origin | مورد نیاز | نقطه شروع نمایش مسیرها را تعریف میکند. | نام مکان، آدرس، کد پلاس، مختصات طول/عرض جغرافیایی یا شناسه مکان که با URL اسکیپ شدهاند. API نقشههای جاسازیشده از هر دو + و %20 هنگام اسکیپ کردن فاصلهها پشتیبانی میکند. برای مثال، "City Hall, New York, NY" را به City+Hall,New+York,NY یا کدهای پلاس "849VCWC8+R9" را به 849VCWC8%2BR9 تبدیل کنید. |
destination | مورد نیاز | نقطه پایانی مسیرها را تعریف میکند. | نام مکان، آدرس، کد پلاس، مختصات طول/عرض جغرافیایی یا شناسه مکان که با URL اسکیپ شدهاند. API نقشههای جاسازیشده از هر دو + و %20 هنگام اسکیپ کردن فاصلهها پشتیبانی میکند. برای مثال، "City Hall, New York, NY" را به City+Hall,New+York,NY یا کدهای پلاس "849VCWC8+R9" را به 849VCWC8%2BR9 تبدیل کنید. |
waypoints | اختیاری | یک یا چند مکان واسطه را برای مسیریابی بین مبدا و مقصد مشخص میکند. | نام مکان، آدرس یا شناسه مکان . با استفاده از کاراکتر پایپ (|) برای جدا کردن مکانها، میتوان چندین نقطه مسیر مشخص کرد (مثلاً Berlin,Germany|Paris,France ). میتوانید تا 20 نقطه مسیر مشخص کنید. |
mode | اختیاری | روش سفر را تعریف میکند. اگر هیچ حالتی مشخص نشده باشد، API نقشههای جاسازیشده یک یا چند حالت مرتبطتر را برای مسیر مشخصشده نشان میدهد. | driving ، walking (که مسیرهای عابر پیاده و پیادهروها را در صورت وجود ترجیح میدهد)، bicycling (که مسیرهایی با استفاده از مسیرهای دوچرخهسواری و خیابانهای ترجیحی را در صورت وجود ترجیح میدهد)، transit یا flying . |
avoid | اختیاری | ویژگیهایی را که باید در مسیرها از آنها اجتناب شود، مشخص میکند. توجه داشته باشید که این امر مسیرهایی را که شامل ویژگی(های) محدود شده هستند، مسدود نمیکند؛ بلکه نتیجه را به سمت مسیرهای مطلوبتر متمایل میکند. | tolls ، ferries و/یا highways . مقادیر چندگانه را با کاراکتر پایپ از هم جدا کنید (مثلاً avoid=tolls|highways ). |
units | اختیاری | روش اندازهگیری، متریک یا امپریال، را هنگام نمایش فواصل در نتایج مشخص میکند. اگر units مشخص نشده باشند، کشور origin پرسوجو واحدهای مورد استفاده را تعیین میکند. | metric یا imperial |
center | اختیاری | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
حالت streetview
API نقشههای جاسازیشده به شما امکان میدهد تصاویر نمای خیابان را به صورت پانوراماهای تعاملی از مکانهای تعیینشده در سراسر منطقه تحت پوشش آن نمایش دهید. تصاویر کروی (Photosphere) که توسط کاربران ارائه میشوند و مجموعههای ویژه نمای خیابان نیز در دسترس هستند.
هر پانورامای نمای خیابان، یک نمای کامل ۳۶۰ درجه از یک مکان واحد ارائه میدهد. تصاویر شامل ۳۶۰ درجه نمای افقی (یک پوشش کامل) و ۱۸۰ درجه نمای عمودی (از مستقیم به بالا تا مستقیم به پایین) هستند. حالت streetview نمایشگری را ارائه میدهد که پانورامای حاصل را به صورت یک کره با یک دوربین در مرکز آن نمایش میدهد. میتوانید دوربین را برای کنترل زوم و جهت دوربین دستکاری کنید.
پانورامای حالت streetview زیر را ببینید:
https://www.google.com/maps/embed/v1/streetview
?key=YOUR_API_KEY
&location=46.414382,10.013988
&heading=210
&pitch=10
&fov=35یکی از پارامترهای URL زیر الزامی است:
تابع
locationیک عرض جغرافیایی و یک طول جغرافیایی را به عنوان مقادیر جدا شده با کاما میپذیرد (46.414382,10.013988). این API، پانورامای عکاسی شده در نزدیکترین فاصله به این مکان را نمایش میدهد. از آنجا که تصاویر Street View به صورت دورهای بهروزرسانی میشوند و عکسها ممکن است هر بار از موقعیتهای کمی متفاوت گرفته شوند، این امکان وجود دارد که مکان شما هنگام بهروزرسانی تصاویر، پانورامای متفاوتی را نمایش دهد.panoیک شناسه خاص پانوراما است. اگر یکpanoمشخص کنید، میتوانید یکlocationنیز مشخص کنید. اینlocationفقط در صورتی استفاده میشود که API نتواند شناسه پانوراما را پیدا کند.
پارامترهای URL زیر اختیاری هستند:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
heading | اختیاری | جهت قطبنمای دوربین را بر حسب درجه در جهت عقربههای ساعت از شمال نشان میدهد. | مقدار بر حسب درجه از ۱۸۰- تا ۳۶۰ درجه |
pitch | اختیاری | زاویه دوربین را، به سمت بالا یا پایین، مشخص میکند. مقادیر مثبت، دوربین را به سمت بالا و مقادیر منفی، دوربین را به سمت پایین زاویه میدهند. شیب پیشفرض ۰ درجه بر اساس موقعیت دوربین هنگام گرفتن تصویر تنظیم میشود. به همین دلیل، شیب ۰ درجه اغلب، اما نه همیشه، افقی است. به عنوان مثال، تصویری که روی تپه گرفته شده است، احتمالاً شیب پیشفرضی را نشان میدهد که افقی نیست. | مقدار بر حسب درجه از ۹۰- تا ۹۰ درجه |
fov | اختیاری | میدان دید افقی تصویر را تعیین میکند. به طور پیشفرض روی ۹۰ درجه تنظیم شده است. هنگام کار با یک دریچه دید با اندازه ثابت، میدان دید را میتوان سطح زوم در نظر گرفت، که اعداد کوچکتر نشان دهنده سطح زوم بالاتر هستند. | مقدار بر حسب درجه، با محدوده ۱۰ تا ۱۰۰ درجه |
center | اختیاری | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
حالت search
حالت Search نتایج جستجو را در سراسر ناحیه قابل مشاهده نقشه نمایش میدهد. توصیه میشود که یک مکان برای جستجو تعریف شود، یا با گنجاندن یک مکان در عبارت جستجو ( record+stores+in+Seattle ) یا با گنجاندن پارامتر center و zoom برای محدود کردن جستجو.
https://www.google.com/maps/embed/v1/search
?key=YOUR_API_KEY
&q=record+stores+in+Seattleمیتوانید از پارامترهای زیر استفاده کنید:
| پارامتر | نوع | توضیحات | مقادیر پذیرفته شده |
|---|---|---|---|
q | مورد نیاز | عبارت جستجو را تعریف میکند. | میتواند شامل یک محدودیت جغرافیایی باشد، مانند in+Seattle یا near+98033 . |
center | اختیاری | مرکز نمای نقشه را تعریف میکند. | مقادیر طول و عرض جغرافیایی جدا شده با کاما را میپذیرد؛ برای مثال: 37.4218,-122.0840 . |
zoom | اختیاری | سطح بزرگنمایی اولیه نقشه را تنظیم میکند. | مقادیر از 0 (کل جهان) تا 21 (ساختمانهای منفرد) متغیر است. حد بالا میتواند بسته به دادههای نقشه موجود در مکان انتخاب شده متفاوت باشد. |
maptype | اختیاری | نوع کاشیهای نقشه برای بارگذاری را تعریف میکند. | roadmap (پیشفرض) یا satellite |
language | اختیاری | زبان مورد استفاده برای عناصر رابط کاربری و نمایش برچسبها روی کاشیهای نقشه را تعریف میکند. به طور پیشفرض، بازدیدکنندگان نقشه را به زبان خودشان مشاهده میکنند. این پارامتر فقط برای برخی از کاشیهای کشور پشتیبانی میشود؛ اگر زبان خاص درخواستی برای مجموعه کاشی پشتیبانی نشود، از زبان پیشفرض آن مجموعه کاشی استفاده خواهد شد. | |
region | اختیاری | مرزها و برچسبهای مناسب برای نمایش را بر اساس حساسیتهای ژئوپلیتیکی تعریف میکند. | کد منطقهای مشخص شده به عنوان یک زیربرچسب منطقهای یونیکد دو کاراکتری (غیر عددی) را میپذیرد که به مقادیر دو کاراکتری ccTLD ("دامنه سطح بالا") معروف نگاشت میشود. برای مناطق پشتیبانی شده به جزئیات پوشش پلتفرم نقشههای گوگل مراجعه کنید. |
پارامترهای شناسه مکان
API نقشههای جاسازیشده (Maps Embed API) از استفاده از شناسههای مکان به جای ارائه نام یا آدرس مکان پشتیبانی میکند. شناسههای مکان روشی پایدار برای شناسایی منحصر به فرد یک مکان هستند. برای اطلاعات بیشتر، به مستندات Places API (جدید) مراجعه کنید.
API نقشههای جاسازیشده، شناسههای مکان را برای پارامترهای URL زیر میپذیرد:
-
q -
origin -
destination -
waypoints
برای استفاده از شناسه مکان، ابتدا باید پیشوند place_id: اضافه کنید. کد زیر تالار شهر نیویورک را به عنوان مبدا درخواست مسیر مشخص میکند: origin=place_id:ChIJs--MqP1YwokRBwAhjXWIHn8 .
radiusشعاعی را که بر حسب متر مشخص شده است، برای جستجوی پانوراما با محوریت طول و عرض جغرافیایی مشخص شده تعیین میکند. مقادیر معتبر، اعداد صحیح غیر منفی هستند. مقدار پیشفرض ۵۰ است.sourceجستجوهای نمای خیابان را به منابع انتخاب شده محدود میکند. مقادیر معتبر عبارتند از:-
defaultاز منابع پیشفرض برای نمای خیابان استفاده میکند؛ جستجوها محدود به منابع خاصی نیستند. -
outdoorجستجوها را به مجموعههای فضای باز محدود میکند. مجموعههای فضای بسته در نتایج جستجو لحاظ نمیشوند. توجه داشته باشید که ممکن است تصاویر پانورامای فضای باز برای مکان مشخص شده وجود نداشته باشند. همچنین توجه داشته باشید که جستجو فقط پانوراماهایی را برمیگرداند که در آنها بتوان تشخیص داد که آیا آنها در فضای بسته هستند یا در فضای باز. به عنوان مثال، PhotoSphereها برگردانده نمیشوند زیرا مشخص نیست که آیا آنها در فضای باز هستند یا در فضای بسته.
-
این راهنما نحوه جاسازی یک نقشه تعاملی را در صفحه وب شما نشان میدهد.
ایجاد URL API جاسازی نقشهها
در زیر یک نمونه URL که API مربوط به Maps Embed را بارگذاری میکند، مشاهده میکنید:
https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS
جایگزین کنید:
- MAP_MODE با حالت نقشه شما.
- YOUR_API_KEY به همراه کلید API خود وارد کنید. برای اطلاعات بیشتر، به دریافت کلید API مراجعه کنید.
- PARAMETERS با پارامترهای مورد نیاز و اختیاری برای حالت نقشه شما.
URL را به یک iframe اضافه کنید
برای استفاده از API نقشههای جاسازیشده در صفحه وب خود، URL ساختهشده را به عنوان مقدار ویژگی src یک iframe تنظیم کنید. اندازه نقشه را با ویژگیهای height و width iframe کنترل کنید، برای مثال:
<iframe
width="450"
height="250"
frameborder="0" style="border:0"
referrerpolicy="strict-origin-when-cross-origin"
src="https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS"
allowfullscreen>
</iframe>نمونه iframe بالا از ویژگیهای اضافی زیر استفاده میکند:
- ویژگی
allowfullscreenبرای اینکه به بخشهای خاصی از نقشه اجازه دهد تمام صفحه شوند. - ویژگیهای
frameborder="0"وstyle="border:0"برای حذف حاشیه استاندارد iframe از اطراف نقشه. -
referrerpolicy="strict-origin-when-cross-origin"تضمین میکند که مرورگر دامنه وبسایت شما را به عنوان سربرگRefererبه گوگل ارسال میکند. این امر به محدودیتهای کلید API اجازه میدهد تا درخواست را تأیید کنند، در حالی که مسیرهای خاص صفحه شما را خصوصی نگه میدارند.
شما میتوانید اندازه iframe را متناسب با ساختار و طراحی وبسایت خود تغییر دهید، اما ما متوجه شدهایم که بازدیدکنندگان معمولاً با نقشههای بزرگتر راحتتر تعامل میکنند. توجه داشته باشید که نقشههای جاسازی شده در هر دو بعد، با اندازه کمتر از ۲۰۰ پیکسل پشتیبانی نمیشوند.
اطلاعات ارجاعدهنده و محدودیتهای کلید API
اگر وبسایت میزبان دارای متا تگ referrer باشد که روی no-referrer یا same-origin تنظیم شده باشد، مرورگر هدر Referer را به گوگل ارسال نمیکند. این ممکن است باعث شود محدودیت کلید API شما درخواستها را رد کند. برای اینکه این محدودیت به درستی کار کند، مانند مثال بالا، یک ویژگی referrerpolicy به iframe اضافه کنید تا صریحاً اجازه ارسال هدرهای Referer به گوگل را بدهد.
-
strict-origin-when-cross-origin(توصیه شده): فقط دامنه اصلی شما (مثلاً https://example.com/) را به گوگل ارسال میکند. این کار مسیرهای خاص صفحات شما را خصوصی نگه میدارد و در عین حال اجازه میدهد محدودیتهای کلید API عمل کنند. -
no-referrer-when-downgrade(Legacy): کل URL، شامل مسیرهای خاص صفحه و پارامترهای پرس و جو (مثلاً https://example.com/contact?user=123) را ارسال میکند.
Learn more about the Referrer-Policy header.
Choose map modes
You can specify one of the following map modes to use in your request URL:
-
place: displays a map pin at a particular place or address, such as a landmark, business, geographic feature, or town. -
view: returns a map with no markers or directions. -
directions: displays the path between two or more specified points on the map, as well as the distance and travel time. -
streetview: shows interactive panoramic views from designated locations. -
search: shows results for a search across the visible map region.
place mode
The following URL uses the place map mode to display a map marker at the Eiffel Tower:
https://www.google.com/maps/embed/v1/place
?key=YOUR_API_KEY
&q=Eiffel+Tower,Paris+FranceYou can use the following parameters:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
q | مورد نیاز | Defines map marker location. | URL-escaped place name, address, plus code, or place ID . The Maps Embed API supports both + and %20 when escaping spaces. For example, convert "City Hall, New York, NY" to City+Hall,New+York,NY , or plus codes "849VCWC8+R9" to 849VCWC8%2BR9 . |
center | اختیاری | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
view mode
The following example uses the view mode and optional maptype parameter to display a satellite view of the map:
https://www.google.com/maps/embed/v1/view
?key=YOUR_API_KEY
¢er=-33.8569,151.2152
&zoom=18
&maptype=satelliteYou can use the following parameters:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
center | مورد نیاز | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
directions mode
The following example uses directions mode to display the path between Oslow and Telemark, Norway, the distance, and travel time avoiding tolls and highways.
https://www.google.com/maps/embed/v1/directions
?key=YOUR_API_KEY
&origin=Oslo+Norway
&destination=Telemark+Norway
&avoid=tolls|highwaysYou can use the following parameters:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
origin | مورد نیاز | Defines the starting point from which to display directions. | URL-escaped place name, address, plus code, latitude/longitude coordinates, or place ID . The Maps Embed API supports both + and %20 when escaping spaces. For example, convert "City Hall, New York, NY" to City+Hall,New+York,NY , or plus codes "849VCWC8+R9" to 849VCWC8%2BR9 . |
destination | مورد نیاز | Defines the endpoint of the directions. | URL-escaped place name, address, plus code, latitude/longitude coordinates, or place ID . The Maps Embed API supports both + and %20 when escaping spaces. For example, convert "City Hall, New York, NY" to City+Hall,New+York,NY , or plus codes "849VCWC8+R9" to 849VCWC8%2BR9 . |
waypoints | اختیاری | Specifies one or more intermediary places to route directions between the origin and destination. | Place name, address, or place ID . Multiple waypoints can be specified by using the pipe character (|) to separate places (eg Berlin,Germany|Paris,France ). You can specify up to 20 waypoints. |
mode | اختیاری | Defines the method of travel. If no mode is specified the Maps Embed API will show one or more of the most relevant modes for the specified route. | driving , walking (which prefers pedestrian paths and sidewalks, where available), bicycling (which prefers routes using bike paths and preferred streets where available), transit , or flying . |
avoid | اختیاری | Specifies features to avoid in directions. Note that this doesn't preclude routes that include the restricted feature(s); it biases the result to more favorable routes. | tolls , ferries and/or highways . Separate multiple values with the pipe character (eg avoid=tolls|highways ). |
units | اختیاری | Specifies measurement method, metric or imperial, when displaying distances in the results. If units are not specified, the origin country of the query determines the units to use. | metric or imperial |
center | اختیاری | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
streetview mode
The Maps Embed API lets you display Street View images as interactive panoramas from designated locations throughout its coverage area . User contributed Photospheres , and Street View special collections are also available.
Each Street View panorama provides a full 360-degree view from a single location. Images contain 360 degrees of horizontal view (a full wrap-around) and 180 degrees of vertical view (from straight up to straight down). The streetview mode provides a viewer that renders the resulting panorama as a sphere with a camera at its center. You can manipulate the camera to control the zoom and the orientation of the camera.
See the following streetview mode panorama:
https://www.google.com/maps/embed/v1/streetview
?key=YOUR_API_KEY
&location=46.414382,10.013988
&heading=210
&pitch=10
&fov=35One of the following URL parameters are required :
locationaccepts a latitude and a longitude as comma-separated values (46.414382,10.013988). The API displays the panorama photographed closest to this location. Because Street View imagery is periodically refreshed, and photographs may be taken from slightly different positions each time, it's possible that your location may snap to a different panorama when imagery is updated.panois a specific panorama ID. If you specify apanoyou may also specify alocation. Thelocationis only used if the API cannot find the panorama ID.
The following URL parameters are optional:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
heading | اختیاری | Indicates the compass heading of the camera in degrees clockwise from North. | Value in degrees from -180° to 360° |
pitch | اختیاری | specifies the angle, up or down, of the camera. Positive values will angle the camera up, while negative values will angle the camera down. The default pitch of 0° is set based on on the position of the camera when the image was captured. Because of this, a pitch of 0° is often, but not always, horizontal. For example, an image taken on a hill will likely exhibit a default pitch that is not horizontal. | Value in degrees from -90° to 90° |
fov | اختیاری | determines the horizontal field of view of the image. It defaults to 90°. When dealing with a fixed-size viewport the field of view is can be considered the zoom level, with smaller numbers indicating a higher level of zoom. | Value in degrees, with a range of 10° - 100° |
center | اختیاری | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
search mode
Search mode displays results for a search across the visible map region. It's recommended that a location for the search be defined, either by including a location in the search term ( record+stores+in+Seattle ) or by including a center and zoom parameter to bound the search.
https://www.google.com/maps/embed/v1/search
?key=YOUR_API_KEY
&q=record+stores+in+SeattleYou can use the following parameters:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
q | مورد نیاز | Defines the search term. | It can include a geographic restriction, such as in+Seattle or near+98033 . |
center | اختیاری | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
Place ID parameters
The Maps Embed API supports using place IDs instead of supplying a place name or address. Place IDs are stable way to uniquely identify a place. For more information, see the Places API (New) documentation .
The Maps Embed API accepts place IDs for the following URL parameters:
-
q -
origin -
destination -
waypoints
To use a place ID, you must first add the prefix place_id: . The following code specifies New York City Hall as the origin for a directions request: origin=place_id:ChIJs--MqP1YwokRBwAhjXWIHn8 .
radiussets a radius, specified in meters, in which to search for a panorama, centered on the given latitude and longitude. Valid values are non-negative integers. Default value is 50.sourcelimits Street View searches to selected sources. Valid values are:-
defaultuses the default sources for Street View; searches are not limited to specific sources. -
outdoorlimits searches to outdoor collections. Indoor collections are not included in search results. Note that outdoor panoramas may not exist for the specified location. Also note that the search only returns panoramas where it's possible to determine whether they're indoors or outdoors. For example, PhotoSpheres are not returned because it's unknown whether they are indoors or outdoors.
-
This guide shows how to embed an interactive map onto your web page.
Create the Maps Embed API URL
The following is an example URL that loads the Maps Embed API:
https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS
Replace:
- MAP_MODE with your map mode .
- YOUR_API_KEY with your API key. For more information, see Get API key .
- PARAMETERS with the required and optional parameters for your map mode.
Add the URL into an iframe
To use the Maps Embed API on your web page, set the URL you've built as the value of an iframe's src attribute. Control the map's size with the iframe's height and width attributes, for example:
<iframe
width="450"
height="250"
frameborder="0" style="border:0"
referrerpolicy="strict-origin-when-cross-origin"
src="https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS"
allowfullscreen>
</iframe>The iframe sample above uses the additional properties:
- The
allowfullscreenproperty to allow certain map parts to go full screen. - The
frameborder="0"andstyle="border:0"properties to remove the standard iframe border from around the map. - The
referrerpolicy="strict-origin-when-cross-origin"property ensures the browser sends your website's domain as theRefererheader to Google. This allows API key restrictions to validate the request, while keeping your specific page paths private.
You can resize the iframe to suit the structure and design of your own website, but we find that visitors usually find it easier to interact with larger maps. Note that embedded maps are not supported below a size of 200 px in either dimension.
Referrer information and API key restrictions
If the hosting website has a referrer meta tag being set to no-referrer or same-origin , the browser won't send the Referer header to Google. This may cause your API key restriction to reject the requests. For the restriction to work properly, add a referrerpolicy property to the iframe, as in the example above, to explicitly allow Referer headers to be sent to Google.
-
strict-origin-when-cross-origin(Recommended): Sends only your base domain (eg, https://example.com/) to Google. This keeps your specific page paths private while still allowing API key restrictions to function. -
no-referrer-when-downgrade(Legacy): Sends the entire URL, including specific page paths and query parameters (eg, https://example.com/contact?user=123).
Learn more about the Referrer-Policy header.
Choose map modes
You can specify one of the following map modes to use in your request URL:
-
place: displays a map pin at a particular place or address, such as a landmark, business, geographic feature, or town. -
view: returns a map with no markers or directions. -
directions: displays the path between two or more specified points on the map, as well as the distance and travel time. -
streetview: shows interactive panoramic views from designated locations. -
search: shows results for a search across the visible map region.
place mode
The following URL uses the place map mode to display a map marker at the Eiffel Tower:
https://www.google.com/maps/embed/v1/place
?key=YOUR_API_KEY
&q=Eiffel+Tower,Paris+FranceYou can use the following parameters:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
q | مورد نیاز | Defines map marker location. | URL-escaped place name, address, plus code, or place ID . The Maps Embed API supports both + and %20 when escaping spaces. For example, convert "City Hall, New York, NY" to City+Hall,New+York,NY , or plus codes "849VCWC8+R9" to 849VCWC8%2BR9 . |
center | اختیاری | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
view mode
The following example uses the view mode and optional maptype parameter to display a satellite view of the map:
https://www.google.com/maps/embed/v1/view
?key=YOUR_API_KEY
¢er=-33.8569,151.2152
&zoom=18
&maptype=satelliteYou can use the following parameters:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
center | مورد نیاز | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
directions mode
The following example uses directions mode to display the path between Oslow and Telemark, Norway, the distance, and travel time avoiding tolls and highways.
https://www.google.com/maps/embed/v1/directions
?key=YOUR_API_KEY
&origin=Oslo+Norway
&destination=Telemark+Norway
&avoid=tolls|highwaysYou can use the following parameters:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
origin | مورد نیاز | Defines the starting point from which to display directions. | URL-escaped place name, address, plus code, latitude/longitude coordinates, or place ID . The Maps Embed API supports both + and %20 when escaping spaces. For example, convert "City Hall, New York, NY" to City+Hall,New+York,NY , or plus codes "849VCWC8+R9" to 849VCWC8%2BR9 . |
destination | مورد نیاز | Defines the endpoint of the directions. | URL-escaped place name, address, plus code, latitude/longitude coordinates, or place ID . The Maps Embed API supports both + and %20 when escaping spaces. For example, convert "City Hall, New York, NY" to City+Hall,New+York,NY , or plus codes "849VCWC8+R9" to 849VCWC8%2BR9 . |
waypoints | اختیاری | Specifies one or more intermediary places to route directions between the origin and destination. | Place name, address, or place ID . Multiple waypoints can be specified by using the pipe character (|) to separate places (eg Berlin,Germany|Paris,France ). You can specify up to 20 waypoints. |
mode | اختیاری | Defines the method of travel. If no mode is specified the Maps Embed API will show one or more of the most relevant modes for the specified route. | driving , walking (which prefers pedestrian paths and sidewalks, where available), bicycling (which prefers routes using bike paths and preferred streets where available), transit , or flying . |
avoid | اختیاری | Specifies features to avoid in directions. Note that this doesn't preclude routes that include the restricted feature(s); it biases the result to more favorable routes. | tolls , ferries and/or highways . Separate multiple values with the pipe character (eg avoid=tolls|highways ). |
units | اختیاری | Specifies measurement method, metric or imperial, when displaying distances in the results. If units are not specified, the origin country of the query determines the units to use. | metric or imperial |
center | اختیاری | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
streetview mode
The Maps Embed API lets you display Street View images as interactive panoramas from designated locations throughout its coverage area . User contributed Photospheres , and Street View special collections are also available.
Each Street View panorama provides a full 360-degree view from a single location. Images contain 360 degrees of horizontal view (a full wrap-around) and 180 degrees of vertical view (from straight up to straight down). The streetview mode provides a viewer that renders the resulting panorama as a sphere with a camera at its center. You can manipulate the camera to control the zoom and the orientation of the camera.
See the following streetview mode panorama:
https://www.google.com/maps/embed/v1/streetview
?key=YOUR_API_KEY
&location=46.414382,10.013988
&heading=210
&pitch=10
&fov=35One of the following URL parameters are required :
locationaccepts a latitude and a longitude as comma-separated values (46.414382,10.013988). The API displays the panorama photographed closest to this location. Because Street View imagery is periodically refreshed, and photographs may be taken from slightly different positions each time, it's possible that your location may snap to a different panorama when imagery is updated.panois a specific panorama ID. If you specify apanoyou may also specify alocation. Thelocationis only used if the API cannot find the panorama ID.
The following URL parameters are optional:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
heading | اختیاری | Indicates the compass heading of the camera in degrees clockwise from North. | Value in degrees from -180° to 360° |
pitch | اختیاری | specifies the angle, up or down, of the camera. Positive values will angle the camera up, while negative values will angle the camera down. The default pitch of 0° is set based on on the position of the camera when the image was captured. Because of this, a pitch of 0° is often, but not always, horizontal. For example, an image taken on a hill will likely exhibit a default pitch that is not horizontal. | Value in degrees from -90° to 90° |
fov | اختیاری | determines the horizontal field of view of the image. It defaults to 90°. When dealing with a fixed-size viewport the field of view is can be considered the zoom level, with smaller numbers indicating a higher level of zoom. | Value in degrees, with a range of 10° - 100° |
center | اختیاری | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
search mode
Search mode displays results for a search across the visible map region. It's recommended that a location for the search be defined, either by including a location in the search term ( record+stores+in+Seattle ) or by including a center and zoom parameter to bound the search.
https://www.google.com/maps/embed/v1/search
?key=YOUR_API_KEY
&q=record+stores+in+SeattleYou can use the following parameters:
| پارامتر | نوع | توضیحات | Accepted values |
|---|---|---|---|
q | مورد نیاز | Defines the search term. | It can include a geographic restriction, such as in+Seattle or near+98033 . |
center | اختیاری | Defines center of the map view. | Accepts comma-separated latitude and longitude value; for example: 37.4218,-122.0840 . |
zoom | اختیاری | Sets initial zoom level of the map. | Values ranging from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location. |
maptype | اختیاری | Defines type of map tiles to load. | roadmap (default) or satellite |
language | اختیاری | Defines the language to use for UI elements and for the display of labels on map tiles. By default, visitors will se a map in their own language. This parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. | |
region | اختیاری | Defines the appropriate borders and labels to display, based on geo-political sensitivities. | Accepts a region code specified as a two-character (non-numeric) unicode region subtag mapping to familiar ccTLD ("top-level domain") two-character values. See Google Maps Platform Coverage Details for supported regions. |
Place ID parameters
The Maps Embed API supports using place IDs instead of supplying a place name or address. Place IDs are stable way to uniquely identify a place. For more information, see the Places API (New) documentation .
The Maps Embed API accepts place IDs for the following URL parameters:
-
q -
origin -
destination -
waypoints
To use a place ID, you must first add the prefix place_id: . The following code specifies New York City Hall as the origin for a directions request: origin=place_id:ChIJs--MqP1YwokRBwAhjXWIHn8 .
radiussets a radius, specified in meters, in which to search for a panorama, centered on the given latitude and longitude. Valid values are non-negative integers. Default value is 50.sourcelimits Street View searches to selected sources. Valid values are:-
defaultuses the default sources for Street View; searches are not limited to specific sources. -
outdoorlimits searches to outdoor collections. Indoor collections are not included in search results. Note that outdoor panoramas may not exist for the specified location. Also note that the search only returns panoramas where it's possible to determine whether they're indoors or outdoors. For example, PhotoSpheres are not returned because it's unknown whether they are indoors or outdoors.
-