Library for generating Jvectormap based maps from shapefiles, Works on Python 3
Project description
shp2jvmapgen
Python library for generating jvectormap-based maps from shapefiles, including the user's chosen field from the shapefile to become the id and name of the polygon in the jvectormap. This library runs on Python 3.
A shapefile, in simpler terms, is like a digital map that contains information about the shapes and locations of various features. Think of it as a digital filing cabinet, storing information about roads, buildings, rivers, and other features that make up the geography of a region. It’s not just a static image, but a dynamic collection of data that can be used to analyze and understand the world around us. Whether it's for city planning, environmental studies, or even video game design, the shapefile is a powerful tool that provides a way to represent and analyze real-world data in a spatial context.
jVectorMap is a library for creating interactive vector maps on a web page. It's like having a digital world map at your fingertips, where you can zoom in, zoom out, and even highlight different regions. But what makes jVectorMap different from a regular map is that it's designed to be used in web applications, meaning you can easily add it to your website or web-based project. With jVectorMap, you can display information in a way that's both visually appealing and interactive, allowing your users to explore the data and gain insights in a fun and engaging way. So, whether you're working on a data visualization project, creating a geography quiz, or just looking for an interactive way to display information, jVectorMap is a tool worth checking out.
jVectorMap relies on JavaScript to work and it only supports its own format for map data. This means that in order to use jVectorMap, you'll need to provide it with a map in jVectorMap format or convert an existing map into this format. And this is the python library to convert your shapefiles into jvectormaps.
First, import the library to your python console:
from shp2jvmapgen import shp2jvmap as s2jvm
The library use JVMapgenerator class to make new object, then convert your shapefile to jvectormap while setting the width pixel to apply into your jvectormap
JVMapgenerator:
First, you need to inisiate the class.
generator = s2jvm.JVMapGenerator()
Continue to shapefile exploration function. Use printFields() method to know the layer fields names. With this method you can
print all fields of your shapefile, then you can choose and use them as jvectormap polygon id and name attributes.
generator.printFields('path/to/file.shp')
Once you have selected your id and name, you have to call run() method. This function require 5 parameters: The shapefile file path, the output file path, name and id as you've choosen and width pixel value that is an integer or float, like you can see below. This method will create the jvectormap file in the defined output file path.
width_pixel = 800
id_field = 'ID'
name_field = 'Region_Name'
input_file= 'path/to/input_file.shp'
output_file = 'path/to/output_file.js'
generator.run(input_file, output_file, id_field, name_field, width_pixel)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file shp2jvmapgen-0.0.1.tar.gz
.
File metadata
- Download URL: shp2jvmapgen-0.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f834f3b8ab25e015e7295ba607a5a42e8dace314e75dbc87c17554311cf66804 |
|
MD5 | c2b99c4b09dffae1d6fed0a0ca2260e5 |
|
BLAKE2b-256 | 097e608f719e0d19da933a899fae48cd1a58f56bdfd3a05c2a7030f97c240bf6 |
File details
Details for the file shp2jvmapgen-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: shp2jvmapgen-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0693ec973191d08e5b289904d66545a491be8306a9b34302658d627065bb071f |
|
MD5 | d1b647da8f205f495df8a7a9fdb88883 |
|
BLAKE2b-256 | d1a5608787c976949b613d0d4a9abc03dc92e471c187e2fc5dea0d9b3551cd5f |