npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

strapi-enhanced-geodata

v0.1.4

Published

geo data

Readme

Strapi GeoData - Enhanced Version

A powerful Strapi v5 plugin that adds dynamic geolocation functionality with customizable maps, search capabilities, and comprehensive configuration options.

🙏 Credits

This plugin is a fork and enhanced version of the original strapi-geodata plugin created by red-made. We extend our gratitude to the original author for providing the foundational codebase that made this enhanced version possible.

What's New in This Fork

  • Dynamic Configuration: Fully configurable from Strapi's config/plugins.ts
  • Spanish Interface: Complete Spanish translation and localization
  • Custom Default Locations: Set default map center and marker positions
  • Search Configuration: Customizable address search with country filtering
  • UI Flexibility: Show/hide interface elements as needed
  • CORS Proxy: Built-in geocoding proxy to avoid CORS issues
  • Zoom Controls: Configurable default, min, and max zoom levels
  • Multiple Map Providers: Support for different tile layer providers

❗ Requirements

  • Strapi v5+
  • Node.js 18+

📦 Installation

npm install strapi-geodata
yarn add strapi-geodata
pnpm add strapi-geodata

🚀 Configuration

Basic Setup in config/plugins.ts

export default {
  geodata: {
    enabled: true,
    config: {
      // Map default settings
      defaultMap: {
        center: {
          lat: 14.557316602350959, // Guatemala City
          lng: -90.73227524766911
        },
        zoom: 15, // Initial zoom level
        maxZoom: 18, // Maximum zoom allowed
        minZoom: 5   // Minimum zoom allowed
      },

      // Default marker/pin position
      defaultMarker: {
        lat: 14.557316602350959,
        lng: -90.73227524766911,
        draggable: true // Whether the marker can be dragged
      },

      // Address search configuration
      search: {
        enabled: true, // Enable/disable address search
        placeholder: "Buscar dirección en Guatemala...", // Search box placeholder
        limit: 5, // Maximum number of search results
        countryCode: 'gt' // Filter results by country (Guatemala)
      },

      // User interface options
      ui: {
        showCoordinatesInput: true, // Show lat/lng input fields
        showSearchBox: true, // Show address search box
        showCurrentValue: true, // Show current JSON value
        language: 'es' // Interface language ('es' or 'en')
      },

      // Map tile layer configuration
      tileLayer: {
        url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
        attribution: '© OpenStreetMap contributors'
      }
    }
  }
}

🌍 Country-Specific Examples

Mexico Configuration

geodata: {
  enabled: true,
  config: {
    defaultMap: {
      center: { lat: 19.4326, lng: -99.1332 }, // Mexico City
      zoom: 10
    },
    search: {
      countryCode: 'mx',
      placeholder: "Buscar dirección en México..."
    }
  }
}

Spain Configuration

geodata: {
  enabled: true,
  config: {
    defaultMap: {
      center: { lat: 40.4168, lng: -3.7038 }, // Madrid
      zoom: 12
    },
    search: {
      countryCode: 'es',
      placeholder: "Buscar dirección en España..."
    }
  }
}

United States Configuration

geodata: {
  enabled: true,
  config: {
    defaultMap: {
      center: { lat: 39.8283, lng: -98.5795 }, // Center of US
      zoom: 4
    },
    search: {
      countryCode: 'us',
      placeholder: "Search address in United States..."
    },
    ui: {
      language: 'en'
    }
  }
}

🎯 Minimal Configuration

For a simple map without search or coordinate inputs:

geodata: {
  enabled: true,
  config: {
    defaultMap: {
      center: { lat: 14.557, lng: -90.732 },
      zoom: 12
    },
    ui: {
      showCoordinatesInput: false,
      showSearchBox: false,
      showCurrentValue: false
    }
  }
}

🗺️ Custom Map Providers

MapBox Configuration

tileLayer: {
  url: 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}',
  attribution: '© Mapbox © OpenStreetMap',
  id: 'mapbox/streets-v11',
  accessToken: 'your_mapbox_token_here'
}

CartoDB Configuration

tileLayer: {
  url: 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png',
  attribution: '© CARTO © OpenStreetMap contributors'
}

🛠️ How It Works

The plugin adds a custom field type that creates an interactive map interface with the following features:

Adding Locations

  1. Coordinate Input: Enter latitude and longitude manually and click "Establecer Ubicación"
  2. Address Search: Type an address and click "Buscar"
  3. Map Interaction: Navigate the map and right-click to place a marker

Data Storage

The plugin automatically creates and populates these fields:

  • lat: Latitude (float)
  • lng: Longitude (float)
  • geohash: Geohash string for spatial queries

API Usage

When creating/updating content programmatically, use this format:

{
  "location_field": {
    "lat": 14.557316602350959,
    "lng": -90.73227524766911
  }
}

The lat, lng, and geohash fields will be automatically populated.

🔧 Strapi Security Configuration

Add this to your config/middlewares.ts to allow map assets:

export default [
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "script-src": [
            "'self'",
            "unsafe-inline",
            "https://*.basemaps.cartocdn.com",
          ],
          "media-src": [
            "'self'",
            "blob:",
            "data:",
            "https://*.basemaps.cartocdn.com",
            "https://tile.openstreetmap.org",
            "https://*.tile.openstreetmap.org",
          ],
          "img-src": [
            "'self'",
            "blob:",
            "data:",
            "https://*.basemaps.cartocdn.com",
            "market-assets.strapi.io",
            "https://*.tile.openstreetmap.org",
            "https://unpkg.com/[email protected]/dist/images/",
          ],
        },
      },
    },
  },
];

🚫 CORS Solution

This enhanced version includes a built-in CORS proxy for geocoding requests. No additional configuration needed - address search works out of the box!

The plugin automatically creates a /api/geocode/search endpoint in your Strapi application that proxies requests to Nominatim with proper headers.

🌐 Internationalization

Spanish (Default)

  • Complete Spanish interface
  • Localized placeholders and messages
  • Spanish address search

English

Set ui.language: 'en' in your configuration for English interface.

📋 Configuration Reference

defaultMap Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | center.lat | number | 14.557316602350959 | Default latitude | | center.lng | number | -90.73227524766911 | Default longitude | | zoom | number | 15 | Initial zoom level | | maxZoom | number | 18 | Maximum zoom level | | minZoom | number | 5 | Minimum zoom level |

defaultMarker Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | lat | number | 14.557316602350959 | Initial marker latitude | | lng | number | -90.73227524766911 | Initial marker longitude | | draggable | boolean | true | Whether marker can be dragged |

search Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | enabled | boolean | true | Enable address search | | placeholder | string | "Buscar dirección..." | Search input placeholder | | limit | number | 5 | Max search results | | countryCode | string | "gt" | ISO country code filter |

ui Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | showCoordinatesInput | boolean | true | Show lat/lng inputs | | showSearchBox | boolean | true | Show address search | | showCurrentValue | boolean | true | Show current JSON value | | language | string | "es" | Interface language |

tileLayer Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | url | string | OpenStreetMap URL | Tile server URL | | attribution | string | "© OpenStreetMap contributors" | Map attribution |

🔄 Development

After modifying configuration in config/plugins.ts, restart Strapi:

npm run develop
yarn develop
pnpm develop

🤝 Contributing

This enhanced version maintains compatibility with the original plugin while adding significant new features. We encourage contributions to both this fork and the original project.

Original Repository

📄 License

This project maintains the same license as the original strapi-geodata plugin. Please refer to the original repository for license details.

🐛 Issues & Support

For issues specific to the enhanced features (dynamic configuration, Spanish translation, CORS proxy), please report them in this repository.

For issues related to the core functionality, consider reporting them to the original repository as well to help improve the base plugin.